This is a discussion on insert/update special characters within the MySQL Database forums, part of the Database Forums category; I've been fighting with this for awhile, but can't seem to figure out how to successfully insert/update ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've been fighting with this for awhile, but can't seem to figure out how to
successfully insert/update special characters. Take the 'registered' symbol for example: "My Brand®" After inserting like so the record contains an extra character "My Brand®" I can get the former string to output properly with utf8_encode(), but ends up looking like the latter after an insert/update. Thanks in advance. |
|
|||
|
> I've been fighting with this for awhile, but can't seem to figure out how to
> successfully insert/update special characters. > > Take the 'registered' symbol for example: > > "My Brand®" > > After inserting like so the record contains an extra character > > "My Brand®" > > I can get the former string to output properly with utf8_encode(), but ends > up looking like the latter after an insert/update. What you see is the unicode representation of a latin-1 text. A lot depends on which MySQL version you are using. If you are Using 5.x, send a SET NAMES <encoding> command directly after connecting. Otherwise, MySQL will default to using latin-1 and (re-)transscribe to the field encoding, whatever you configure. And off course, define the right encodings for your fields. Although the latter is more for your own documentation: utf-8 will fit perfectly in a latin-1 field, for example. The ultimate test is the mysqldump utility. If you dump a table with special characters, mysqldump will show you how they are stored internally. Best regards, -- Willem Bogaerts Application smith Kratz B.V. http://www.kratz.nl/ |