[jdom-interest] Hexadecimal character references

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon May 5 07:22:30 PDT 2003


In XMLOutputter, character references should probably be heaxdecimal by 
default. This is how most people know and look up particular character 
codes. That is, change

if (currentFormat.escapeStrategy.shouldEscape(ch)) {
    entity = "&#" + (int)ch + ";";
}

to something like

if (currentFormat.escapeStrategy.shouldEscape(ch)) {
    entity = "&#x" + Integer.toHexString(ch) + ";";
}

This makes it much easier to look up particular codes in the Unicode 
spec and other references.

If anyone really wants decimal character codes, we could make it a 
format option.


--
Elliotte




More information about the jdom-interest mailing list