Here is a code that I am using. (Sorry, I cannot remember where I found it)
I use this in order to submit the value to the server in a URL request-string, but also to handle local characters
local theDescription = alphaBitLib.convertTo1252URLEncode(theFields.theDescriptionField.text)
And here my code to do the encoding:
-- HOW TO SOLVE THE national char problem... -- http://stackoverflow.com/questions/9548275/network-request-and-non-english-characters alphaBitLib.escape = function(s) s = string.gsub(s, "([&=+%c\128-\255])", function (c) return string.format("%%%02X", string.byte(c)) end) s = string.gsub(s, " ", "+") return s end -- print(escape("http://server/aáäbcčdďeé...")) -- \> http://server/a%C3%A1%C3%A4bc%C4%8Dd%C4%8Fe%C3%A9... local windows1252encodeArrayDouble = { "%%20", "%%80", "%%81", "%%82", "%%83", "%%84", "%%85", "%%86", "%%87", "%%88", "%%89", "%%8A", "%%8B", "%%8C", "%%8D", "%%8E", "%%8F", "%%90", "%%91", "%%92", "%%93", "%%94", "%%95", "%%96", "%%97", "%%98", "%%99", "%%9A", "%%9B", "%%9C", "%%9D", "%%9E", "%%9F", "%%A0", "%%A1", "%%A2", "%%A3", "%%A4", "%%A5", "%%A6", "%%A7", "%%A8", "%%A9", "%%AA", "%%AB", "%%AC", "%%AD", "%%AE", "%%AF", "%%B0", "%%B1", "%%B2", "%%B3", "%%B4", "%%B5", "%%B6", "%%B7", "%%B8", "%%B9", "%%BA", "%%BB", "%%BC", "%%BD", "%%BE", "%%BF", "%%C0", "%%C1", "%%C2", "%%C3", "%%C4", "%%C5", "%%C6", "%%C7", "%%C8", "%%C9", "%%CA", "%%CB", "%%CC", "%%CD", "%%CE", "%%CF", "%%D0", "%%D1", "%%D2", "%%D3", "%%D4", "%%D5", "%%D6", "%%D7", "%%D8", "%%D9", "%%DA", "%%DB", "%%DC", "%%DD", "%%DE", "%%DF", "%%E0", "%%E1", "%%E2", "%%E3", "%%E4", "%%E5", "%%E6", "%%E7", "%%E8", "%%E9", "%%EA", "%%EB", "%%EC", "%%ED", "%%EE", "%%EF", "%%F0", "%%F1", "%%F2", "%%F3", "%%F4", "%%F5", "%%F6", "%%F7", "%%F8", "%%F9", "%%FA", "%%FB", "%%FC", "%%FD", "%%FE", "%%FF" } local utf8encodeArray = { "%E2%82%AC", "%81", "%E2%80%9A", "%C6%92", "%E2%80%9E", "%E2%80%A6", "%E2%80%A0", "%E2%80%A1", "%CB%86", "%E2%80%B0", "%C5%A0", "%E2%80%B9", "%C5%92", "%C5%8D", "%C5%BD", "%8F", "%C2%90", "%E2%80%98", "%E2%80%99", "%E2%80%9C", "%E2%80%9D", "%E2%80%A2", "%E2%80%93", "%E2%80%94", "%CB%9C", "%E2%84", "%C5%A1", "%E2%80", "%C5%93", "%9D", "%C5%BE", "%C5%B8", "%C2%A0", "%C2%A1", "%C2%A2", "%C2%A3", "%C2%A4", "%C2%A5", "%C2%A6", "%C2%A7", "%C2%A8", "%C2%A9", "%C2%AA", "%C2%AB", "%C2%AC", "%C2%AD", "%C2%AE", "%C2%AF", "%C2%B0", "%C2%B1", "%C2%B2", "%C2%B3", "%C2%B4", "%C2%B5", "%C2%B6", "%C2%B7", "%C2%B8", "%C2%B9", "%C2%BA", "%C2%BB", "%C2%BC", "%C2%BD", "%C2%BE", "%C2%BF", "%C3%80", "%C3%81", "%C3%82", "%C3%83", "%C3%84", "%C3%85", "%C3%86", "%C3%87", "%C3%88", "%C3%89", "%C3%8A", "%C3%8B", "%C3%8C", "%C3%8D", "%C3%8E", "%C3%8F", "%C3%90", "%C3%91", "%C3%92", "%C3%93", "%C3%94", "%C3%95", "%C3%96", "%C3%97", "%C3%98", "%C3%99", "%C3%9A", "%C3%9B", "%C3%9C", "%C3%9D", "%C3%9E", "%C3%9F", "%C3%A0", "%C3%A1", "%C3%A2", "%C3%A3", "%C3%A4", "%C3%A5", "%C3%A6", "%C3%A7", "%C3%A8", "%C3%A9", "%C3%AA", "%C3%AB", "%C3%AC", "%C3%AD", "%C3%AE", "%C3%AF", "%C3%B0", "%C3%B1", "%C3%B2", "%C3%B3", "%C3%B4", "%C3%B5", "%C3%B6", "%C3%B7", "%C3%B8", "%C3%B9", "%C3%BA", "%C3%BB", "%C3%BC", "%C3%BD", "%C3%BE", "%C3%BF" } local utfencodeArrayDouble = { " ", "%%E2%%82%%AC", "%%81", "%%E2%%80%%9A", "%%C6%%92", "%%E2%%80%%9E", "%%E2%%80%%A6", "%%E2%%80%%A0", "%%E2%%80%%A1", "%%CB%%86", "%%E2%%80%%B0", "%%C5%%A0", "%%E2%%80%%B9", "%%C5%%92", "%%C5%%8D", "%%C5%%BD", "%%8F", "%%C2%%90", "%%E2%%80%%98", "%%E2%%80%%99", "%%E2%%80%%9C", "%%E2%%80%%9D", "%%E2%%80%%A2", "%%E2%%80%%93", "%%E2%%80%%94", "%%CB%%9C", "%%E2%%84", "%%C5%%A1", "%%E2%%80", "%%C5%%93", "%%9D", "%%C5%%BE", "%%C5%%B8", "%%C2%%A0", "%%C2%%A1", "%%C2%%A2", "%%C2%%A3", "%%C2%%A4", "%%C2%%A5", "%%C2%%A6", "%%C2%%A7", "%%C2%%A8", "%%C2%%A9", "%%C2%%AA", "%%C2%%AB", "%%C2%%AC", "%%C2%%AD", "%%C2%%AE", "%%C2%%AF", "%%C2%%B0", "%%C2%%B1", "%%C2%%B2", "%%C2%%B3", "%%C2%%B4", "%%C2%%B5", "%%C2%%B6", "%%C2%%B7", "%%C2%%B8", "%%C2%%B9", "%%C2%%BA", "%%C2%%BB", "%%C2%%BC", "%%C2%%BD", "%%C2%%BE", "%%C2%%BF", "%%C3%%80", "%%C3%%81", "%%C3%%82", "%%C3%%83", "%%C3%%84", "%%C3%%85", "%%C3%%86", "%%C3%%87", "%%C3%%88", "%%C3%%89", "%%C3%%8A", "%%C3%%8B", "%%C3%%8C", "%%C3%%8D", "%%C3%%8E", "%%C3%%8F", "%%C3%%90", "%%C3%%91", "%%C3%%92", "%%C3%%93", "%%C3%%94", "%%C3%%95", "%%C3%%96", "%%C3%%97", "%%C3%%98", "%%C3%%99", "%%C3%%9A", "%%C3%%9B", "%%C3%%9C", "%%C3%%9D", "%%C3%%9E", "%%C3%%9F", "%%C3%%A0", "%%C3%%A1", "%%C3%%A2", "%%C3%%A3", "%%C3%%A4", "%%C3%%A5", "%%C3%%A6", "%%C3%%A7", "%%C3%%A8", "%%C3%%A9", "%%C3%%AA", "%%C3%%AB", "%%C3%%AC", "%%C3%%AD", "%%C3%%AE", "%%C3%%AF", "%%C3%%B0", "%%C3%%B1", "%%C3%%B2", "%%C3%%B3", "%%C3%%B4", "%%C3%%B5", "%%C3%%B6", "%%C3%%B7", "%%C3%%B8", "%%C3%%B9", "%%C3%%BA", "%%C3%%BB", "%%C3%%BC", "%%C3%%BD", "%%C3%%BE", "%%C3%%BF" } alphaBitLib.convertTo1252URLEncode = function(theString) theString = alphaBitLib.escape(theString); for i=1,#utf8encodeArray do local lookfor = utfencodeArrayDouble[i]; local replacewith = windows1252encodeArrayDouble[i]; if (lookfor ~= replacewith) then theString = string.gsub(theString,lookfor,replacewith); end end return theString end