Notebook Worksheet Unicode Problem

6 views
Skip to first unread message

NoSyu

unread,
Jul 4, 2009, 9:55:55 AM7/4/09
to sage-devel
Hello.


I use Sagemath to show the Linear Algebra problems solution.

And I am Korean.

Therefore I write the comments in Korean using p or div html tag in
worksheet like this.

http://nosyu.pe.kr/attach/1/5682987737.png


If I want to modify the sentence, I just double click the sentence.
Then modified textarea is appeared.

But if the sentence is written in Korean, the character is broken like
this.

http://nosyu.pe.kr/attach/1/5274736490.png

So I click the 'save changes', then broken sentence is saved. Of
course, I can't read it.

http://nosyu.pe.kr/attach/1/4710829034.png


The reason is that worksheet html code is like this.

data : '<p>\xea\xb3\xb5\xec\x8b\x9d\xec\x97\x90 \xeb\x94\xb0\xeb\x9d
\xbc \xed\x95\xa8\xec\x88\x98\xeb\xa5\xbc \xec\xa0\x95\xec\x9d\x98\xed
\x95\x98\xec\x98\x80\xec\x8a\xb5\xeb\x8b\x88\xeb\x8b\xa4.</p>'

It is just unicode number. So web browser doesn't understand this.



So I find the python code and modify it.

sageroot/devel/sage/sage/server/notebook/cell.py:211

211 : </script>"""%(self.__id,self.__id,self.__text)

=>

211 : </script>"""%(self.__id,self.__id,((self.__text).decode
('utf-8')).encode('ascii', 'xmlcharrefreplace'))

then I can see the right character in modified textarea.

http://nosyu.pe.kr/attach/1/1598983532.png

Now worksheet html is like this.

data : '<p>&#44277;&#49885;&#50640; &#46384;&#46972;
&#54632;&#49688;&#47484;
&#51221;&#51032;&#54616;&#50688;&#49845;&#45768;&#45796;.</p>'



Therefore I suggest that the code is rewrite to handle the unicode
characters.



I write about it in my blog.(Sorry, it is writen in Korean.)

http://nosyu.pe.kr/2039

Minh Nguyen

unread,
Jul 4, 2009, 2:30:20 PM7/4/09
to sage-...@googlegroups.com
Hi,

On Sat, Jul 4, 2009 at 11:55 PM, NoSyu<don...@gmail.com> wrote:
>
> Hello.
>
>
> I use Sagemath to show the Linear Algebra problems solution.
>
> And I am Korean.
>
> Therefore I write the comments in Korean using p or div html tag in
> worksheet like this.
>
> http://nosyu.pe.kr/attach/1/5682987737.png

<SNIP>

Ticket #6417 seems to be related to this. This will be shipped with Sage 4.1.

--
Regards
Minh Van Nguyen

NoSyu

unread,
Jul 4, 2009, 8:56:38 PM7/4/09
to sage-devel
Hello

There is a better solution.

Thanks to introduce the ticket.^^

Minh Nguyen

unread,
Jul 4, 2009, 10:10:07 PM7/4/09
to sage-...@googlegroups.com
Hi,

On Sat, Jul 4, 2009 at 11:55 PM, NoSyu<don...@gmail.com> wrote:
>

<SNIP>

> So I find the python code and modify it.
>
> sageroot/devel/sage/sage/server/notebook/cell.py:211
>
> 211 : </script>"""%(self.__id,self.__id,self.__text)
>
> =>
>
> 211 : </script>"""%(self.__id,self.__id,((self.__text).decode
> ('utf-8')).encode('ascii', 'xmlcharrefreplace'))

This is now ticket #6464:

http://trac.sagemath.org/sage_trac/ticket/6464

Thank you for reporting.

Reply all
Reply to author
Forward
0 new messages