Converting between character sets

This is a discussion on Converting between character sets within the MySQL Database forums, part of the Database Forums category; If I have a column with the word Dürer in it can I use the Convert function to convert ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-21-2006
starritt@gmail.com
 
Posts: n/a
Default Converting between character sets


If I have a column with the word Dürer in it can I use the Convert
function to convert it to Durer by down-shifting into a 7 bit character
set?! -- I can do this in Oracle. I am scripting with PHP and whenever
I use convert it seems to leave me with a situation where ü becomes a
question mark.

The database is latin1 by default -- if this isnt possible can anybody
think or point me toward a way of querying a column and bring back
records that might have Dürer or Durer only using Durer in my where
clause -- diacritic insensitivity essentially. Working in Oracle
great, but here I am stuck --

Reply With Quote
  #2 (permalink)  
Old 03-21-2006
Axel Schwenke
 
Posts: n/a
Default Re: Converting between character sets

starritt@gmail.com wrote:
>
> If I have a column with the word Dürer in it can I use the Convert
> function to convert it to Durer by down-shifting into a 7 bit character
> set?! -- I can do this in Oracle.


When using MySQL you should stay away from Oracle "solutions" ;-)

> The database is latin1 by default -- if this isnt possible can anybody
> think or point me toward a way of querying a column and bring back
> records that might have Dürer or Durer only using Durer in my where
> clause -- diacritic insensitivity essentially.


If your MySQL version is 4.1 or above you can use MySQLs collation
support to achive diacritic insensitive string comparison.
(if your MySQL version is 4.0 or lower you should consider upgrading)

The latin1_german1_* collations work as you expect:

mysql> SELECT 'Dürer' = 'Durer' COLLATE latin1_german1_ci AS german1,
'Dürer' = 'Durer' COLLATE latin1_german2_ci AS german2;
+---------+---------+
| german1 | german2 |
+---------+---------+
| 1 | 0 |
+---------+---------+

The relevant chapter in the manual is:

http://dev.mysql.com/doc/refman/5.0/en/charset.html -- especially
http://dev.mysql.com/doc/refman/5.0/...t-we-sets.html -- and
http://dev.mysql.com/doc/refman/5.0/...t-collate.html


XL
--
Axel Schwenke, Senior Software Developer, MySQL AB

Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
MySQL User Forums: http://forums.mysql.com/
Reply With Quote
Reply


Thread Tools
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

vB 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 03:43 PM.


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