Robert Leleu wrote: > Willem Bogaerts skribis : >> Dear group, >> >> I run Knoda on Xubuntu, which uses utf-8 as the native encoding. >> However, for MySQL, no "SET NAMES utf8" is sent upon connection. This >> means that the connection defaults to "latin1" (iso-8859-1). Knoda then >> tries to render latin-1 data as if it were utf-8 encoded. >> >> The nicest solution is to send the command "SET NAMES utf8" immediately >> upon connection. This sounds simple, but I know it is not. I do not know >> if it is easy to see what encoding the OS is running on, and alas every >> encoding name has to be translated to MySQL identifiers (that is why >> there are no minus characters in the encoding names in MySQL). >> Furthermore, the SET NAMES command is only present in MySQL 4.1 and >> higher (which can be read with "SELECT VERSION()", or probably a C >> function). >> >> I am using Knoda 0.8.3. >> >> Best regards, > Mandriva 2007 UTF-8, Knoda, Mysql, et je ne suis pas expert. > J'ai créé les tables par import CSV, en veillant à ce que les fichiers > CSV soient bien UTF-8. > Mon application me produit des exports CSV UTF-8 > Je n'ai donné aucune instruction mysql (j'en suis incapable) > > Mandriva 2007 UTF-8, Knoda, Mysql, kaj mi ne estas fakulo > Mi kreis la datarojn fare eniro CSV, zorgante ke la CSV-aj dataroj estus > UTF-8 > Mia uzilo faras UTF-8 CSV elirdatarojn > Mi skribis neniun mysql linjojn (tion mi ne eblas) > > Mandriva 2007 UTF-8, Knoda, Mysql, I am no expert > I created the database importing from CSV files, duly UTF-8 prepared > My application produces UTF-8 CSV export files > I don't write any instruction to Mysql, I'm not able to do so...
In this case, it will go wrong in two places: utf-8 will be imported as latin-1, and upon export the opposite will occur. For example, a euro sign (0xE282AC) will be interpreted as "€", which might look as garbage, but is perfectly valid latin-1. If your table fields are defined as utf-8 encoded, these three characters are then RE-encoded to the byte sequence 0xC3A2E2809AC2AC. On export, the exact opposite will occur, so you will end up with the correct original data in the exported file. As a test, import some csv data with special characters (accented characters, euro sign, etc.) and just view the table contents in Knoda. If your test data contained "€", it would be rendered as a euro sign. Example definition for a test table: CREATE TABLE character_test(contents VARCHAR(255))CHARACTER SET utf8; It will create a table called "character_test" with just one field, called "contents". Thanks for your answer, -- Willem Bogaerts Applicatiesmid Kratz B.V. http://www.kratz.nl/ ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Hk-classes-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss
