kiss9815 / mongoose

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

Lua with sqlite3 for saving unicode characters #402

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
From .lp page it is not possible to show characters in unicode.
I added unicode characters using sqlite3 console application.

<database value input - manually>
sqlite> insert into test ('1', '한글');

when I try to show this row the characters are broken.

<.lp code>

stmt = db:prepare('SELECT * FROM test;')
    while stmt:step() == sqlite3.ROW do
        local v = stmt:get_values()
        mg.write(v[1] .. ' ' .. v[2] .. ' ' .. v[3] .. ' '.. v[4] .. ' ' .. v[5] .. ' ' .. v[6] .. ' ' .. v[7] ..'<br>')
  end

<result in browser>
1234 �ѱ���

* Additionally sqlite in Lua pages cannot save cannot save unicode characters 
properly.

Original issue reported on code.google.com by sape...@gmail.com on 23 Aug 2013 at 1:13

GoogleCodeExporter commented 9 years ago
I converted all characters into UTF-8 format-based characters whenever I store 
string data into sqllight database. (ex> Insert into test values ('%3%1%d%a')) 

Original comment by sape...@gmail.com on 4 Jul 2014 at 7:28