[cfe-dev] Wide strings and clang::StringLiteral.

Chris Lattner clattner at apple.com
Mon Dec 1 21:10:21 PST 2008


On Nov 29, 2008, at 1:00 AM, Paolo Bolzoni wrote:

>
> I need to convert the strings literals to other encoding, I was  
> planning to
> use iconv.h's functions, but I need to know the encoding of the  
> input strings.
>
> So the question is, what encoding have the strings returned by
> clang::StringLiteral::getStrData(), overall wide ones?

Hi Paolo,

I really have no idea.  We're just reading in the raw bytes from the  
source file, so I guess it depends on whatever the source encoding  
is.  In practice, this sounds like a really bad idea :).

Clang doesn't have any notion of an input character set at present,  
and doesn't handle unicode escapes.  How do other compilers handle  
input character sets?  Are there command line options to specify it?   
Should the AST hold the string in a canonical form like UTF8?

-Chris



More information about the cfe-dev mailing list