Put URL into variable and textEncoding

Paul Dupuis paul at researchware.com
Mon Feb 12 21:04:24 EST 2018


On 2/12/2018 8:49 PM, Monte Goulding via use-livecode wrote:
>
>> On 13 Feb 2018, at 11:56 am, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> something more sensible
> We already have:
>
> open file for “utf-8” text
>
> There was some discussion of implementing “file+<encoding>:/path/to/file” style urls to avoid having to use binfile and textDecode and manual line ending wrangling.
>
> Also if there is a BOM then the unicode encoding can and is worked for file: urls and open file for text. It’s when there’s no BOM and no explicit encoding specified that the engine defaults to legacy native encodings.

It is this last case (no BOM) that a 'guessEncoding(<file>)' function is
needed in LiveCode so those of us that make app that deal with end user
files (which can be of variable 'type' and whose encoding is generally
completely unknown to the user) do no have to each write our own.

I will happily offer the guessEncoding script we wrote from common
algorithms for this task if only LiveCode would add it to the engine. Or
any one else that has written a guessEncoding script could offer these
and LiveCode could pick the "best" one and add it to the engine.





More information about the use-livecode mailing list