blackberry / WebWorks-TabletOS

BlackBerry WebWorks for Tablet OS is a platform for building deeply integrated web applications for the BlackBerry PlayBook
http://us.blackberry.com/developers/tablet/webworks.jsp
Apache License 2.0
70 stars 14 forks source link

WebWorks SDK does not permit non-ASCII characters in //widget/name in config.xml #47

Open chawco opened 12 years ago

chawco commented 12 years ago

When producing applications with internationalized names (i.e., UTF-8 encoded but outside of normal ASCII range), WebWorks will throw an error while packaging the .bar file. The behaviour is reproducible with either simple UTF-8 encoded strings within config.xml, or when using XML-escaped unicode code point entities.

Example (note //widget/name):

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        id="myappid"
        version="0.5.11"
        rim:header="RIM-Widget:rim/widget">
  <name>é</name>
...

Or alternatively:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        id="myappid"
        version="0.5.11"
        rim:header="RIM-Widget:rim/widget">
  <name>&#233;</name>
...

Both cases result in the following output from the 'bbwp' utility:

bbwp build/bin/myapp.zip -o build/bin/
[INFO]        Parsing command line options
[INFO]        Parsing bbwp.properties
[INFO]        Validating WebWorks archive
[INFO]        Parsing config.xml 
[INFO]        Populating application source
[INFO]        Compiling WebWorks application
[INFO]        Packaging the bar file
Error: Invalid byte 1 of 1-byte UTF-8 sequence.

Judging from this behaviour, it appears the name byte stream is being interpreted into a non-UTF-8 encoded stream, and passed to some internal process which is expecting a UTF-8 encoded stream.