UTF encoding is certainly a "dark spot" in XMLVM. Neither the
Objective-C nor the C backend handle this correctly. I recently
implemented a string constant pool for the C backend that should use a
proper default encoding for string constants. But it will probably not
work for strings you read from files.
If you have any spare cycles to look into this, may I suggest you try to
fix this for the C backend? We are finally very close to switching to
the new C backend (only the GC integration is missing right now) and I
would much rather invest resources in the C backend.
To guide you (or anyone else interested in looking into this), take a
look at class java.lang.String in source folder
xmlvm/src/xmlvm2c/lib/proxies. The source of java.lang.String is taken
from the Apache Harmony Project and the cross-compiled version will be
included in any C project that uses java.lang.String. Take a look at
line 308 of String.java. I commented out that constructor. As you can
see, this constructor uses a Charset for proper UTF conversion.
The job basically boils down to uncommenting that constructor and
"making it work". This means that classes such as Charset have to be
taken off the red list. Take a look at the slides in xmlvm/doc/slides
(look for the slides entitled "J2SE Library") to understand what I mean
by "red list".
Any UTF gurus out there who might be willing to look into this?
Arno
On 4/28/11 3:27 PM, Domenico De Fano wrote:
> Hi all,
>
> I'm having an issue displaying special characters on an
> internationalization process. I'm not sure if I need to do something at
> Cocoa level
> or if there is something missing in XMLVM.
> I have some plain internationalization files containing the text for my
> application in different languages, following the UTF8 standard.
> >From my java application, I load these files using InputStream and
> then convert the read data to strings.
> The problem is that on the iPhone simulator this text is not showed
> correctly as I think the ASCII encoding is used instead of UTF8.
>
> I tried to have a look at the java_lang_InputStream.m file but all I
> found is a call to xmlvmSubclassResponsibility
> which I really don't know what is (searching the whole xmlvm project I
> couldn't match any implementation of this function).
> I also checked the java_lang_String.m file to see how a string is
> created from an array of bytes. Here there seems to be no problems
> too as the bytes are appended one by one as char; still I have the doubt
> wether I need an NSUTF8String or not to obtain the
> correct visualization of the string.
>
> Do you have any ideas?
>
>
> Thanks
>
> --
> Domenico De Fano
>
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
>
>
>
> _______________________________________________
> Xmlvm-developers mailing list
> Xml...@li...
> https://lists.sourceforge.net/lists/listinfo/xmlvm-developers
|