Re: newbie &nbsp representation question

Le lundi 03 août 2009 à 16:36 -0600, J. Waldram a écrit :
> I have searched the archives and have seen only one related post from 2006 
> on an older version of Amaya.  Amaya 11.2, with the "Keep multiple 
> Spaces" option, the &nbsp is represented as a hex byte 0xa0 instead of 
>   or  .  Is this a mis-translation for the 
> &nbsp that is rendered by browsers?  

The nbsp character is represented as:
 1) a hex byte 0xa0 when the document is utf-8 encoded
 2)   when the document is not utf-8 encoded and there is a doctype
    that declares the entity
 3)   or   when the document is not utf-8 encoded and there is
    not a doctype that declares the entity

If Amaya generates a hex byte, the document is considered as utf-8
encoded. If it's not, the bug is there.

> Since XML does not allow &nbsp 
> and the &#xa0 is allowed could this be recoded as a text string not a hex 
> byte?  Amaya source code views show it as a "~" (tilde) which is less 
> obvious in coding and some browsers render it as a literal character.

Amaya source code views show it as a "~" (tilde) to let know to the
author that there is a nbsp which is not managed as a single space.
A single space can be removed or allows a line break; this is not true
for a nbsp.

> This is in a
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> 
> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
>    <meta http-equiv="Content-Style-Type" content="text/css" />
> 
> I did not want to muck with the source code.  I do not
> know enough to see the ramifications of changes.
> Are the relevant parts in translate.c the place to make changes?
> 
> Thank you,
> 
> -Jim Waldram
> 
> 
-- 
Irene Vatton <Irene.Vatton@inria.fr>
INRIA

Received on Tuesday, 18 August 2009 08:06:43 UTC