0

I have a question about sending and receiving data with special chars. (Turkish Character)

I am having trouble converting Turkish characters. For example "Ğğ Üü İı Şş Öö Çç" when I try to get these characters out, it transforms the characters like this "Ðð Üü Ýý þ Öö Çç".

How can i fix this. I do my transactions in Lua.

Sabuncu
  • 5,095
  • 5
  • 55
  • 89
  • What kind of conversion are you looking for? (Ğ cannot be encoded in ASCII; there are specific versions of Extended ASCII that can encode it, but you need to specify which one.) When you say "get these characters out," what do you mean? What Lua code are you currently using that gives the results you list? Are you certain that the inputs are in UTF-8? – Rob Napier Oct 23 '20 at 14:17
  • I want to convert from windows-1254 to unicode. The code example is as follows. – Ali YILDIZ Oct 23 '20 at 14:20
  • Thanks. Please update the question and title with details. Converting Windows-1254 to Unicode is completely different from UTF-8 to ASCII. And when you say Unicode, what encoding do you mean? Do you mean UTF-8? Or do you mean 32-bit integer code points? – Rob Napier Oct 23 '20 at 14:22
  • If you're running this code on Windows, and want to convert from the native code page to and from UTF-8, you may want to look at https://github.com/xpol/lua-native. If you're trying to apply this conversion elsewhere, update your question with that. Lua generally just uses the local system encodings, and treats strings as sequences of raw bytes. – Rob Napier Oct 23 '20 at 14:32
  • Thanks for the help. I'm doing the development in Lua. – Ali YILDIZ Oct 23 '20 at 14:40
  • Understood. The rest of the questions are still open: What do mean by "get these characters out?" What Lua code are you currently using? When you say Unicode, what encoding do you mean? Are you always running this code on Windows, or are you providing text that was created on Windows as an input somewhere else? – Rob Napier Oct 23 '20 at 18:01
  • 1
    To convert from win-1254 to UTF-8, you can use [this module](https://gitlab.com/-/snippets/2033412). Do not forget to change `codepage` variable to `1254`. – Egor Skriptunoff Oct 26 '20 at 23:29

0 Answers0