replaced by 0xa0 in the output

26 views
Skip to first unread message

flobro30101

unread,
Apr 3, 2014, 10:33:14 AM4/3/14
to gen...@googlegroups.com
So the output displays as something other than a space character. I have the encodeing set in python to utf-8.
See template below.


Using python 2.7 on Fedora 19
Genshi 0.7-3


Thanks for pointing out my missing something.



<html  xmlns="http://www.w3.org/1999/xhtml"
          xmlns:py="http://genshi.edgewall.org/">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<br clear="all"/>
<table border="0" width="100%">
<tbody><tr><td>nobody</td></tr>
<tr><td>nowhere</td></tr>
<tr><td>anytown, usa</td></tr>
</tbody>
</table>

<br/><br/><br/><br/><br/><br/><br/>

<table border="0" width="100%">
<tbody><tr><td>${name}</td></tr>
<tr><td>${addr1}</td></tr>
<tr><td>${addr2}</td></tr>
<tr><td>${city},${state}&nbsp;${zip}</td></tr>
</tbody>
</table>
<hr style="border-style: dashed;" />
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
</body>
</html>

Simon Cross

unread,
Apr 3, 2014, 4:11:22 PM4/3/14
to gen...@googlegroups.com
Hello!

If you do:

>>> from genshi.input import XML
>>> XML("<p>&nbsp;</p>").render()
u'<p>\xa0</p>'

You'll see that Genshi turns &nbsp; into \xa0 -- the Unicode
non-breaking space character
(http://en.wikipedia.org/wiki/Non-breaking_space).

Hope that clarifies things!

Schiavo
Simon
Reply all
Reply to author
Forward
0 new messages