W3C home > Mailing lists > Public > www-amaya@w3.org > July to September 2009

Re: newbie &nbsp representation question

From: Irene Vatton <Irene.Vatton@inria.fr>
Date: Tue, 18 Aug 2009 10:06:11 +0200
To: "J. Waldram" <jwaldram@uwyo.edu>
Cc: www-amaya@w3c.org
Message-Id: <1250582771.6587.45.camel@vanuatu.inrialpes.fr>
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 
> &#160; or &#xa0;.  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) &nbsp; when the document is not utf-8 encoded and there is a doctype
    that declares the entity
 3) &#160; or &#xa0; 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>
Received on Tuesday, 18 August 2009 08:06:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:30:57 UTC