tags:

views:

221

answers:

1

Is there a character or encoding I can do to escape a custom property in a JAD file for a J2ME application?

Example: Would the extra : in this property break the Jad on some devices, and is there an escape language (like HTML encoding) that I could use to make this a valid property entry?

Custom-Property-1: Nokia : 6150 / X.15

+1  A: 

The extra colon won't matter. It will just be part of the value for your property.

JSR 37 says:

"the format of the application descriptor is a sequence of lines consisting of an attribute name followed by a colon, the value of the attribute, and a carriage return. White space is ignored before and after the value."

There can be other JAD 'gotchas', depending on your target device or devices. Best to keep the JAD small, no more than 5K in some cases, and no extra long lines, or lines with continuation.

See notes here for more info on JAD content, especially note that ISO-8859-1 encoding is preferred because it should be supported by all handsets, and that unicode escape sequences (like \u00A9 = copyright sign) can be used if needed.

EDIT

JSR 118 contains a BNF for parsing JAD content:

appldesc: *attrline
attrline: attrname “:” [WSP] attrvalue [WSP] newlines
attrname: 1*<any Unicode char except CTLs or separators>
attrvalue: *valuechar | valuechar *(valuechar | WSP) valuechar
valuechar: <any valid Unicode character, excluding CTLS and WSP>
newlines = 1*newline ; allow blank lines to be ignored
newline: CR LF | LF
CR = <Unicode carriage return (U+000D)>
LF = <Unicode linefeed (U+000A)>
WSP: 1*( SP | HT )
SP = <Unicode space (U+0020)>
HT = <Unicode horizontal-tab (U+0009)>
CTL = <Unicode characters
U+0000 - U+001F and U+007F>
separators: “(” | “)” | “<” | “>” | “@” | “,” | “;” |
            “:” | “'” | <“> | “/” | “[” | “]” | “?” | 
            “=” | “{” | “}” | SP | HT
martin clayton