[jdom-interest] non-breakable space

Tatu Saloranta cowtowncoder at yahoo.com
Wed Dec 3 10:13:50 PST 2008


--- On Wed, 12/3/08, Jabba Laci <jabba.laci at gmail.com> wrote:

> From: Jabba Laci <jabba.laci at gmail.com>
> Subject: Re: [jdom-interest] non-breakable space
> To: "jdom interest" <jdom-interest at jdom.org>
> Date: Wednesday, December 3, 2008, 9:27 AM
> Hi,
> 
> I added the character '\u00A0' to the end of the string, but as a
> result I get "Address: " instead of

That's fine, there's nothing wrong in including character as is.
HTML does not require escaping, it just allows it.

However:

> "Address:&nbsp;". When I verify it in a browser, I have a funny character
> ("Address:Â") at the place of the space.

Sounds like you have incorrect encoding specified; such that content is in Latin1, but page claims to be UTF-8, or vice versa. Nbsp byte itself is expressed differently in different encodings: as a 2-byte sequence in UTF-8, as a single byte in Latin1.

Alternatively, it is possible to make JDOM outputter escape all kinds of characters, for example anything outside of ascii range (char > 127). But you really should fix encoding problems for the page as that is one of most common problems with web page generation, and will eventually cause problems with other characters (accented ones etc).

Hope this helps,

-+ Tatu +-



      



More information about the jdom-interest mailing list