vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly. Special apostrophes and single quotes from Microsoft Word are causing a special problem, even though I have ''ed all 's perhaps the encoding of the database itself should be different? it is currenlty latin_swedish_ci Input and output is through a browser. I think my problem may be that I need to encode the string before saving it in the databse. Can anyone point me in the right direction here? here's the error message: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 95: ordinal not in range(128) args = ('ascii', "update zingers set keywords = 'a;Action;b;Religi... \n \n \n ' where zid = 422", 95, 96, 'ordinal not in range(128)') encoding = 'ascii' end = 96 object = "update zingers set keywords = 'a;Action;b;Religi... \n \n \n ' where zid = 422" reason = 'ordinal not in range(128)' start = 95 the characters I am trying to add are startquote and endquote copied and pasted from Microsoft Word. Can anyone help me on this? bests, -rsr- |
| ||||
| On 1 Jan 2007 21:56:51 -0800, Ron wrote: > I have an MySQL database called zingers. The structure is: > > zid - integer, key, autoincrement > keyword - varchar > citation - text > quotation - text > > I am having trouble storing text, as typed in latter two fields. > Special characters and punctuation all seem not to be stored and > retrieved correctly. > > Special apostrophes and single quotes from Microsoft Word are causing a > special problem, even though I have ''ed all 's Right problem, but wrong solution. The "special apostrophes" from Word aren't the same as "'" either. > perhaps the encoding of the database itself should be different? it is > currenlty latin_swedish_ci That's a collation, not an encoding, nor a character set. It's also missing the '1' after 'latin'. (It's also not your actual problem, so I'm not going to go further into those.) > Input and output is through a browser. > > I think my problem may be that I need to encode the string before > saving it in the databse. Can anyone point me in the right direction > here? You need to *either* strip those special apostrophies out and make them normal puctuation, or ALTER the column's character set to one that does have those "special apostrophies" in it. You'll find them at U+2018, U+2019 and U+201C, U+201D. Which means you'll probably want to use utf8 as your character set. > here's the error message: > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position > 95: ordinal not in range(128) This should be yout first clue. ascii's pretty limited: it's only got 128 characters, and anything with an accent or diacritical of any kind won't fit into the definition. -- Every fleeting thought you've ever had in your life, no matter how bizarre, is someone's lifelong obsession. And he has a website. -- Skif's Internet Theorem |