[SG16-Unicode] [isocpp-core] Source file encoding
Thiago Macieira
thiago at macieira.org
Wed Aug 14 21:50:35 CEST 2019
On Wednesday, 14 August 2019 09:00:43 PDT Steve Downey wrote:
> > #pragma encoding <encoding> switches encoding from the #pragma onwards.
> >
> For the rest of that source file. A push/pop mechanism so you can't cause
> errors in the file doing the inclusion.
You make it for the file in question, not the translation unit. That means it
won't affect #includes and terminates at the end of your #inclusion.
This also means preprocessors need to understand that for the # lines.
# 1 "foo.cpp"
#pragma encoding "utf-8"
"this is UTF-8"
# 1 "foo.h"
#pragma encoding "latin1"
"this is Latin1"
# 3 "foo.cpp"
"this is again automatically UTF-8"
Which could get funny with lex outputs... then again, I don't think lex can
handle multibyte.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel System Software Products
More information about the Unicode
mailing list