Xav, it looks like the ValueResourceParser2 reads in files like this:
            stream = new BufferedInputStream(new FileInputStream(file));
            InputSource is = new InputSource(stream);
            ...
            return builder.parse(is);

Note that it constructs the input stream and XML input source without
specifying a UTF-8 encoding.

The above is correct when you want to actually pick up encodings from the
XML file itself, since the XML prolog can specify an encoding, so the XML
parser expects to get a raw bytestream and to do its own encoding handling.

However, we really discourage users from using custom or default platform
encodings, and lint will complain about any XML files it finds without
UTF-8 encoding.

Perhaps we should just read in the XML as UTF-8 characters instead -- and
maybe we can have the XML parser abort / retry if it encounters an actual
encoding pragma?

In the meantime, Seth -- can you see whether your XML files start with an
encoding prolog, and if not, try putting this at the top of your files (or
at least the ones containing the character entities) :
<?xml version="1.0" encoding="utf-8"?>


On Tue, May 6, 2014 at 10:04 AM, Seth Goldenberg
<[email protected]>wrote:

> All machines I've checked are running the Java SE 1.6.0_65
>
>
> On Tue, May 6, 2014 at 9:57 AM, Xavier Ducrohet <[email protected]> wrote:
>
>> I cannot reproduce either. Normally we force encoding to UTF8 so there
>> shouldn't be different behaviors.
>>
>> Can you check which JVM your 2 machines use?
>>
>>
>> On Mon, May 5, 2014 at 4:55 PM, Seth Goldenberg <
>> [email protected]> wrote:
>>
>>> Strange issue here with merging resources. I have a build machine that's
>>> botching the encoding of some unicode characters in my XML when merging
>>> resources. This is building just fine on my own machine.
>>>
>>> This line is in an exploded AAR prior to being merged:
>>> (From
>>> build/exploded-aar/com.facebook/facebook-android-sdk/3.5.2/res/values/values.xml)
>>> <string name="com_facebook_placepicker_subtitle_format">%1$s • %2$,d
>>> were here</string>
>>>
>>> And like this after being merged:
>>> (From build/res/all/release/values/values.xml)
>>> <string name="com_facebook_placepicker_subtitle_format">%1$s ¥ %2$,d
>>> were here</string>
>>>
>>> aapt (version 19.0.3) chokes with this error on the line above:
>>> error: Error parsing XML: not well-formed (invalid token)
>>>
>>> This error does not happen on my personal machine. Both are running Mac
>>> OS X 10.9.2. What dependency does aapt have that the same version of it
>>> would produce different outputs on different machines?
>>>
>>> Thanks,
>>> Seth
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.
>> http://developer.android.com | http://tools.android.com
>>
>> Please do not send me questions directly. Thanks!
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "adt-dev" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/adt-dev/CER-RNfiYjo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to