alzalabany / sql-buddy

Automatically exported from code.google.com/p/sql-buddy
MIT License
0 stars 0 forks source link

Bug in encoding #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SQL buddy (1.2.9) seems to be having troubles with character encoding. Text
issued by the user is encoded twice before it is stored in the database.
I've attached a screenshot of this issue to make sure the information is
presented correctly.

Steps to reproduce:

1. Run the following SQL:

    DROP TABLE IF EXIST test;

    CREATE TABLE TEST 
        (id INT PRIMARY KEY AUTO_INCREMENT, 
         name VARCHAR(255) CHARACTER SET utf8) 
    DEFAULT CHARACTER SET utf8;

2. Go to table test, and insert a new row with the name "Téèst"

3. Go to the 'browse' view, and check that a row with id '1', and 
   name 'Téèst' is indeed present

4. Now run the following SQL:

    SELECT HEX(name) FROM test WHERE id=1

5. The result of this query is 

    54 C3 83 C2 A9 C3 83 C2 A8 73 74

   which, if translated to ASCII, is the string 'Téèst'

6. The result of this query should have been 

    54 C3 A9 C3 A8 73 74

   which, if translated to ASCII, is the string 'Téèst'

   If you encode that string to UTF8, then you obtain the
   string from point 5.

7. In other words, SQL Buddy converts input to UTF-8 TWICE.

   Any user input is converted to UTF-8, which is then 
   converted to UTF-8, which is eventually stored in the 
   database.

Original issue reported on code.google.com by e.akerboom@gmail.com on 19 Sep 2008 at 10:38

Attachments:

GoogleCodeExporter commented 9 years ago
This problem was fixed in the 1.3.0 release. I performed the steps that you 
described and came out with the 
output from step 6: 54 C3 A9 C3 A8 73 74

Calvin

Original comment by calvinlo...@gmail.com on 26 Sep 2008 at 2:51

GoogleCodeExporter commented 9 years ago
The Hungarian character enconding also wrong.

    >
    Főoldal - Főoldal
    >
    FelhasznĂĄlĂłk - Felhasználók
    >
    KĂŠrĂŠs - Keresés
    >
    ImportĂĄlĂĄs - Importálás
    >
    ExportĂĄlĂĄs - Exportálás

Original comment by tamas.du...@gmail.com on 20 Apr 2015 at 6:37