Professional Web Applications Themes

Converting between character sets - MySQL

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

  1. #1

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

    starritt@gmail.com Guest

  2. #2

    Default Re: Converting between character sets

    [email]starritt[/email] 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:

    [url]http://dev.mysql.com/doc/refman/5.0/en/cht.html[/url] -- especially
    [url]http://dev.mysql.com/doc/refman/5.0/en/cht-we-sets.html[/url] -- and
    [url]http://dev.mysql.com/doc/refman/5.0/en/cht-collate.html[/url]


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

    Online User Manual: [url]http://dev.mysql.com/doc/refman/5.0/en/[/url]
    MySQL User Forums: [url]http://forums.mysql.com/[/url]
    Axel Schwenke Guest

Similar Threads

  1. Romanian Character Sets
    By Harry_Moulis@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 1
    Last Post: August 5th, 05:38 AM
  2. Why did Photoshop CS quit suddenly in the middle of making sets? Action sets
    By blackxacto@adobeforums.com in forum Adobe Photoshop Mac CS, CS2 & CS3
    Replies: 1
    Last Post: May 4th, 04:01 AM
  3. CS quit suddenly in the middle of making Action sets Action sets,
    By blackxacto@adobeforums.com in forum Adobe Photoshop Mac CS, CS2 & CS3
    Replies: 3
    Last Post: May 2nd, 06:06 AM
  4. Replies: 10
    Last Post: July 13th, 10:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139