pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Whitcomb" <Roger.Whitc...@ingres.com>
Subject UTF-8 BOM in JSON files?
Date Tue, 21 Sep 2010 15:01:40 GMT
Hi,

                I am working on internationalization of my application
and got some preliminary translations into German and Japanese.  The
files are true UTF-8 including the UTF-8 BOM at the beginning of the
files (0xEF, 0xBB, 0xBF).  When I try to read these files in as
resources I get this error:

C:\Projects\tooldev\src>java -jar director.jar --language=de

An error occurred while processing input at line number 1

org.apache.pivot.serialization.SerializationException: Unexpected
character in input stream.

        at
org.apache.pivot.json.JSONSerializer.readValue(JSONSerializer.java:222)

        at
org.apache.pivot.json.JSONSerializer.readObject(JSONSerializer.java:188)

        at
org.apache.pivot.json.JSONSerializer.readObject(JSONSerializer.java:154)

        at
org.apache.pivot.util.Resources.readJSONResource(Resources.java:376)

        at org.apache.pivot.util.Resources.<init>(Resources.java:126)

        at org.apache.pivot.util.Resources.<init>(Resources.java:57)

        at com.ingres.director.DirectorMain.startup(Unknown Source)

        at
org.apache.pivot.wtk.DesktopApplicationContext$HostFrame.processWindowEv
ent(DesktopApplicationContext.java:95)

        at java.awt.Window.processEvent(Unknown Source)

        at java.awt.Component.dispatchEventImpl(Unknown Source)

        at java.awt.Container.dispatchEventImpl(Unknown Source)

        at java.awt.Window.dispatchEventImpl(Unknown Source)

        at java.awt.Component.dispatchEvent(Unknown Source)

        at java.awt.EventQueue.dispatchEvent(Unknown Source)

        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)

        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)

        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

        at java.awt.EventDispatchThread.run(Unknown Source)

 

It is hard to get rid of the BOM using my editors, so is there something
else I could/should do to make these files acceptable to Pivot?  Should
the JSONSerializer be able to read and ignore the UTF-8 BOM?

 

BTW, I'm using head revs of Pivot 1.5.x from SVN and specified loading
the Resources with a "UTF-8" Charset and the appropriate Locale:

         String lang = properties.get("language");

         Locale loc = (lang == null) ? Locale.getDefault() : new
Locale(lang);

         Charset cs = Charset.forName("UTF-8");

         resources = new Resources(null, DirectorMain.class.getName(),
loc, cs);

 

Thanks.

Roger Whitcomb

Architect, Engineering

Ingres Corporation

roger.whitcomb@ingres.com <mailto:roger.whitcomb@ingres.com> 

 

PHONE +1 650.587.5596

FAX +1 650.587.5550

 

www.ingres.com <http://www.ingres.com/>  

 

This transmission is confidential and intended solely for the use of the
recipient named above. It may contain confidential, proprietary, or
legally privileged information. If you are not the intended recipient,
you are hereby notified that any unauthorized review, use, disclosure or
distribution is strictly prohibited. If you have received this
transmission in error, please contact the sender by reply e-mail and
delete the original transmission and all copies from your system.

 


Mime
View raw message