On Tue, Aug 15, 2017 at 10:15:01AM -0400, Marc Feeley wrote:
Do you want:
- the compiler to accept source code in UTF-8 character encoding?
- compiled programs to read and write characters using UTF-8 character encoding?
#1 can be done with “gsc -:f8 …” #2 can be done by starting your program with the shebang “#! /usr/bin/env gsi -:t8,f8,-8”.
I've found that the way to handle UTF-8 in my programs is *mostly* to simply ignore the problem. I read bytes, write bytes, and treat anything outside the usual ASCII character set as simply being more letters.
If the application needs anything else to be done with specific characters, I treat this as part of the lexical analyser instead as part of the character reader.
There's no conversion of everything to and from wide characters on input and output.
There are likely applications in which this isn't efficient. And there are likely code points which aren't properly handled this way. But there are a lot for which this is all that is needed.
-- hendrik