List:General Discussion« Previous MessageNext Message »
From:Sebastian Mendel Date:January 21 2008 7:32am
Subject:Re: Handling Special Characters
View as plain text  
Jerry Schwartz schrieb:
> I am having trouble inserting special characters into a table. I am using
> the MySQL client. I put the following commands into a text file (I'm on
> WinXP, using Notepad), copy them, and paste them into the MySQL command line
> client.
> 
> SET NAMES utf8;
> 
> CREATE TEMPORARY TABLE `giiexpr_db`.`eo_name_table` (
> `eo_name` VARCHAR( 255 ) NOT NULL
> ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
> 
> INSERT INTO eo_name_table
>     (eo_name)
> VALUES
> ("Associated British Foods Plc (Abf) - Hot Drinks - World");
> 
> SELECT * FROM eo_name_table;
> +---------------------------------------------------------+
> | eo_name                                                 |
> +---------------------------------------------------------+
> | Associated British Foods Plc (Abf) - Hot Drinks - World |
> +---------------------------------------------------------+
> 1 row in set (0.04 sec)
> 
> That symbol before "World" is an N-dash, 0x96. This works perfectly.
> 
> Here's where things go wrong. If instead of pasting these commands into the
> client, I source the exact same file, I get this:

you need to take care of the used charset with the text-file


> [...]
> 
> Anyone have any ideas? I was trying to avoid having to write a program to do
> this.

use UTF-8 for text files
use SET NAMEs to correctly MySQL what charset you are using



-- 
Sebastian
Thread
Handling Special CharactersJerry Schwartz18 Jan
  • Re: Handling Special CharactersBaron Schwartz18 Jan
    • RE: Handling Special CharactersJerry Schwartz19 Jan
    • RE: Handling Special CharactersJerry Schwartz21 Jan
  • Re: Handling Special CharactersSebastian Mendel21 Jan
    • RE: Handling Special CharactersJerry Schwartz21 Jan