Encoding in the notebook, and I18N

1 view
Skip to first unread message

Gonzalo Tornaria

unread,
Mar 22, 2009, 4:22:03 PM3/22/09
to sage-...@googlegroups.com
In trying to use the notebook in spanish, there's something
"broken" with the encoding which prevents using non-ascii characters.
For example, if one changes the title of a worksheet to something with
non-ascii characters, it seems to work at first, but when going back
to the list of worksheets the title will display wrongly.

I've investigated a bit, and the good news is, I think this must be
pretty easy to fix, because is't *just* an issue with encodings. In
fact, the notebook seems to be unicode-safe, except for the html
serving: it's just that firefox *thinks* the html served by the
notebook is in latin-1 encoding (iso-8859-1), but it is in fact in
utf-8 encoding. Manually changing the encoding makes the page render
ok (accents and all look good).

Thus, the fix that is required is the following:

a) add a

Content-Type: text/html; charset=utf-8

header to the HTTP response given by twisted. This is probably the
best and easier to implement --- I just couldn't find where to do it
in the notebook source, but it must be easy for someone familiar with
notebook code.

b) alternatively, add a line

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

to the <head> section of every page served by the notebook. This I
could do by changing templates and search&replace in the notebook
source, etc... I wouldn't be sure to catch all instances, and in
general I think (a) is preferrable.

Gonzalo

Mike Hansen

unread,
Mar 22, 2009, 5:13:44 PM3/22/09
to sage-devel
Hi Gonzalo,

There has already been some work done on this front:
http://trac.sagemath.org/sage_trac/ticket/5564

--Mike

Gonzalo Tornaria

unread,
Mar 22, 2009, 6:11:46 PM3/22/09
to sage-...@googlegroups.com
Mike,

thanks for your answer. I commented back in
http://trac.sagemath.org/sage_trac/ticket/5564.

Short story: the patches in #4547 and #5211 seem to fix my issues with
utf-8 encoding, but I can't figure out what issues are fixed by the
patches in #5564.

Gonzalo

Dan Drake

unread,
Mar 22, 2009, 9:14:01 PM3/22/09
to sage-...@googlegroups.com
On Sun, 22 Mar 2009 at 07:11PM -0300, Gonzalo Tornaria wrote:
> Short story: the patches in #4547 and #5211 seem to fix my issues with
> utf-8 encoding, but I can't figure out what issues are fixed by the
> patches in #5564.

#5564 fixes a problem where one could enter "complicated" UTF-8 text
(Asian languages are most problematic) and get it to display -- but when
one double-clicked on the cell to edit, the text would get garbled.

Dan

--
--- Dan Drake <dr...@kaist.edu>
----- KAIST Department of Mathematical Sciences
------- http://mathsci.kaist.ac.kr/~drake

signature.asc
Reply all
Reply to author
Forward
0 new messages