insert/update special characters

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2007
keychain
 
Posts: n/a
Default insert/update special characters

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.


Reply With Quote
  #2 (permalink)  
Old 04-18-2007
Willem Bogaerts
 
Posts: n/a
Default Re: insert/update special characters

> 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/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:15 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0