Character Encoding

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10082
Joined: Fri Feb 19, 2010 10:17 am

Character Encoding

Post by richmond62 » Fri May 16, 2025 9:29 am

So: I have 2 sample text files: one in Windows-1251 (Windows encoding for Cyrillic), and one in UTF8 . . .

Code: Select all

on mouseUp
   answer file "A text file"
   if it <> "" then
      put it into theFilePath
      put URL ("file:" & theFilePath) into MYCHEESE
      put textDecode(MYCHEESE, "UTF-8") into fld "f1"
   end if
   put the encoding of fld "f1" into fld "f2"
end mouseUp
Obviously correctly renders the second file . . .

This:

Code: Select all

on mouseUp
   answer file "A text file"
   if it <> "" then
      put it into theFilePath
      put URL ("file:" & theFilePath) into MYCHEESE
      put textDecode(MYCHEESE, "cp1251") into fld "f1"
   end if
   put the encoding of fld "f1" into fld "f2"
end mouseUp
Throws a bluey with the first file (unsurprisingly).

Does anyone know WHERE I can find a list of all the non-unicode character encodings that LiveCode can cope with?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10082
Joined: Fri Feb 19, 2010 10:17 am

Re: Character Encoding

Post by richmond62 » Fri May 16, 2025 9:37 am

viewtopic.php?t=23613

https://livecode.com/livecode-7-0/
“ASCII”

“ISO-8859-1” (Linux only)

“MacRoman” (OSX only)

“Native” (ISO-8859-1 on Linux, MacRoman on OSX, CP1252 Windows)

“UTF-16”

“UTF-16BE”

“UTF-16LE”

“UTF-32”

“UTF-32BE”

“UTF-32LE”

“UTF-8”

“CP1252” (Windows only)
So in no way 'universal'.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10082
Joined: Fri Feb 19, 2010 10:17 am

Re: Character Encoding

Post by richmond62 » Fri May 16, 2025 11:15 am

Presumably somewhere "in the undergrowth" of the IDE lurks code for performing these transforms, and presumably other transforms could be added.

Post Reply