Welcome Guest, Not a member yet? Register   Sign In
Displaying UTF-8 strings
#1

[eluser]Kenneth Allen[/eluser]
I am converting an existing web site to a new site using CI and adding dynamic database support (previously they generated static pages from an Access database). Part of the process is to convert the contents of the Access database to MYSQL. I wrote some C# code ona windows VM to read the Access database and convert the text to UTF8 and write SQL INSERT statements to text file. I then transfer the tex file to my iMac and execute it against a schema I defined there.

I have confirmed that the SQL file contains all UTF characters and that the special characters, especially the ellipses, appear properly in a text editor as well as on the command line.

I also confirmed that the tables are all defined as shown below.

Code:
CREATE TABLE `GraveNotes` (
    `id`                    INTEGER            NOT NULL AUTO_INCREMENT,
    `GraveID`                INTEGER            NOT NULL,
    `CreateDate`            DATETIME        NOT NULL,
    `NoteText`                TEXT            NOT NULL,
    CONSTRAINT `PK_GraveNotes` PRIMARY KEY(`id`),
    CONSTRAINT `FK_GraveNotes_GraveID_Graves` FOREIGN KEY(`GraveID`) REFERENCES `Graves`(`id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

From the command line this looks OK:

Code:
mysql> select * from GraveNotes WHERE GraveID=685;
+-----+---------+---------------------+---------------------------------------------------------------------------------+
| id  | GraveID | CreateDate          | NoteText                                                                        |
+-----+---------+---------------------+---------------------------------------------------------------------------------+
| 204 |     685 | 2010-08-24 00:00:00 | Obit in 'Calgary Herald' but he is not listed in any of 8 Calgary cemeteries… |
+-----+---------+---------------------+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

When I generate a web page that demonstrates some of the database content, however, the ellipses — as an example — are not being rendered properly: see the lines that have 685 and 692 in the second column below.

Code:
202    668    Presunka, Vernon Ivan Dennis    Tue 24 Aug    Died on holidays:Was living in Devon, AB
203    682    Cameron, James Campbell    Tue 24 Aug    Exact DOD not known
204    685    De Grace, Mark Cletus    Tue 24 Aug    Obit in 'Calgary Herald' but he is not listed in any of 8 Calgary cemeteries…
205    688    Denham, Ronald Arthur    Tue 24 Aug    RCMP upright granite
206    692    Fontana, Ronald James    Tue 24 Aug    Obit in 'Calgary Herald' but he is not listed in any of 8 Calgary cemeteries…
207    697    Guyer, Charles Clarence Stephen    Tue 24 Aug    Brass marker at ground level in cement. Small crest of RCMP center top. Good condition

I have also verified that the we page has the proper setting in the header, as shown below.

Code:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

I even went into the CI config. php file and added the line shown below, all to no effect.

Code:
@setlocale(LC_CTYPE, array("en_CA.UTF-8", "en_US.UTF-8"));

I am at a loss to explain why the text from the database is not being rendered properly. Does anyone know if there is some step that I have missed or omitted?


Messages In This Thread
Displaying UTF-8 strings - by El Forum - 08-24-2010, 07:21 PM
Displaying UTF-8 strings - by El Forum - 08-24-2010, 11:33 PM
Displaying UTF-8 strings - by El Forum - 08-25-2010, 01:58 AM
Displaying UTF-8 strings - by El Forum - 08-25-2010, 02:04 AM
Displaying UTF-8 strings - by El Forum - 08-25-2010, 06:31 AM
Displaying UTF-8 strings - by El Forum - 08-25-2010, 07:26 AM
Displaying UTF-8 strings - by El Forum - 08-25-2010, 07:27 AM
Displaying UTF-8 strings - by El Forum - 08-25-2010, 12:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB