Ah, cool. Thanks for letting me know. URL encoding is a nice solution.

On Mon, Dec 23, 2013 at 7:57 AM, 오치민 <[email protected]> wrote:

> Thank. I am very late to see your comment. I used URI-encoding function in
> Lua page.
>
> -- url decoder
> function urldecode(str)
> str = string.gsub(str, '+', ' ')
> str = string.gsub(str, '%%(%x%x)', function(h) return
> string.char(tonumber(h, 16)) end)
> str = string.gsub(str, '\r\n', '\n')
> return str
> end
>
> -- url encoder
> function urlencode(str)
> if str then
> str = string.gsub(str, '\n', '\r\n')
> str = string.gsub(str, '([^%w ])', function(c) return
> string.format('%%%02X', string.byte(c)) end)
> str = string.gsub(str, ' ', '+')
> end
> return str
> end
>
>
>
> On Monday, September 2, 2013 7:41:40 PM UTC+9, Sergey Lyubka wrote:
>
>> I've tried your example with test/page.lp, inserting '한글' by hands, and
>> also
>> other UTF-8 characters, e.g. Cyrillic and Hebrew. Works fine for me,
>> browser renders
>> those strings as expected.
>> Try do this in your lua snippet:
>> db:exec('PRAGMA encoding="UTF-8"; ')
>>
>>
>>
>> On Sat, Aug 24, 2013 at 2:00 AM, 오치민 <[email protected]> wrote:
>>
>>> From .lp Lua 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 n Lua server page not 
>>> in console application where i can see unicode properly.
>>>
>>> <.lp code for reading row from sqlite3>
>>>
>>> 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 �ѱ���
>>>
>>>
>>> In other case when I save unicode characters using Lua server script
>>>
>>> it is not properly saved in sqlite3 database.
>>>
>>> They are broken like 1234 �ѱ���
>>>
>>> when i check in sqlite3 console application
>>>
>>>
>>> I think sqlite3 in lua server page is not able to transfer unicode 
>>> characters properly.
>>>
>>> (I am a newbie here)
>>>
>>>
>>> Now I think to use uri-encode to avoid this problem for saving and reading 
>>> unicode characters.
>>>
>>> But every time i need to encode them with JavaScript and it is difficult to 
>>> split encoded characters from query-string of http-request.
>>>
>>>
>>> * Actually I wrote first here - 
>>> https://code.google.com/p/mongoose/issues/detail?id=402&can=6&q=unicode
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "mongoose-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>> Visit this group at http://groups.google.com/group/mongoose-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "mongoose-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mongoose-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to