Ticket #1120 (assigned defect)

Opened 6 months ago

Last modified 6 months ago

report editor crashs if sample data has unicode

Reported by: carl Assigned to: ed (accepted)
Priority: major Milestone: 0.8.3
Component: reporting Version: 0.8.2
Keywords: unicode Cc:

Description (Last modified by carl)

(python:12684): Gtk-CRITICAL **: gtk_widget_add_accelerator: assertion `GTK_IS_WIDGET (widget)' failed Traceback (most recent call last):

File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14095, in <lambda>

lambda event: event.callable(*event.args, **event.kw) )

File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dPemMixin.py", line 843, in raiseEvent

else:

File "/usr/lib/python2.5/site-packages/dabo/lib/eventMixin.py", line 92, in raiseEvent

bindingFunction(event)

File "/home/carl/dabodev/dabomodule/ide/ReportDesigner.py", line 2327, in onLeaveXmlEditorPage

report = editor._rw._getFormFromXML(editBox.Value)

File "/usr/lib/python2.5/site-packages/dabo/lib/reportWriter.py", line 1816, in _getFormFromXML

def _getFormFromXML(self, xml):

File "/usr/lib/python2.5/site-packages/dabo/lib/xmltodict.py", line 182, in xmltodict

ret = parser.Parse(xml)

File "/usr/lib/python2.5/site-packages/dabo/lib/xmltodict.py", line 156, in Parse

ParserStatus? = Parser.Parse(xml, 1)

UnicodeEncodeError?: 'ascii' codec can't encode character u'\u0107' in position 4521: ordinal not in range(128)

Attachments

badge.rfxml (4.5 kB) - added by carl on 11/16/2007 07:39:43 AM.

Change History

11/16/2007 07:39:43 AM changed by carl

  • attachment badge.rfxml added.

11/16/2007 07:42:57 AM changed by carl

attached doesn't have the sample data.

change full_name="&quot;Carl Karsten&quot;" to full_name="&quot;Ivan Krstić&quot;"

and in case this helps:

"&quot;Ivan Krstić&quot;"

'&quot;Ivan Krsti\xc4\x87&quot;'

11/16/2007 07:44:48 AM changed by carl

Does not crash if I do: full_name="&quot;Ivan Krsti\xc4\x87&quot;"

11/16/2007 11:23:07 AM changed by ed

  • owner set to ed.
  • status changed from new to assigned.

Carl, can you try the changes I just posted? You will have to be sure to edit the .rfxml file if it has non-ASCII characters in it so that it will open correctly, but after that it should save and print unicode normally.

(follow-up: ↓ 5 ) 11/16/2007 12:47:24 PM changed by carl

  • description changed.

carl@dell29:~/dabodev/dabomodule$ svn up U ide/ReportDesigner.py U dabo/lib/xmltodict.py U dabo/version.py Updated to revision 3711.

I have the change, but it behaves the same as before: I cut/paste Krstić into the xml window and get the error but no error if I use Krsti\xc4\x87 - I am guessing this is a case of "don't do that." I will be doing some reading on unicode tonight, because right now I am not really sure what I am doing.

(python:15106): Gtk-CRITICAL **: gtk_widget_add_accelerator: assertion `GTK_IS_WIDGET (widget)' failed Traceback (most recent call last):

File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14095, in <lambda>

lambda event: event.callable(*event.args, **event.kw) )

File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dPemMixin.py", line 842, in raiseEvent

super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, **kwargs)

File "/usr/lib/python2.5/site-packages/dabo/lib/eventMixin.py", line 92, in raiseEvent

bindingFunction(event)

File "/home/carl/dabodev/dabomodule/ide/ReportDesigner.py", line 2325, in onLeaveXmlEditorPage

report = editor._rw._getFormFromXML(editBox.Value)

File "/usr/lib/python2.5/site-packages/dabo/lib/reportWriter.py", line 1820, in _getFormFromXML

xmldict = xmltodict(xml)

File "/usr/lib/python2.5/site-packages/dabo/lib/xmltodict.py", line 182, in xmltodict

ret = parser.Parse(xml)

File "/usr/lib/python2.5/site-packages/dabo/lib/xmltodict.py", line 156, in Parse

ParserStatus? = Parser.Parse(xml, 1)

UnicodeEncodeError?: 'ascii' codec can't encode character u'\u0107' in position 4521: ordinal not in range(128)

(in reply to: ↑ 4 ) 11/16/2007 01:09:16 PM changed by ed

Replying to carl:

I have the change, but it behaves the same as before: I cut/paste Krstić into the xml window and get the error but no error if I use Krsti\xc4\x87 - I am guessing this is a case of "don't do that." I will be doing some reading on unicode tonight, because right now I am not really sure what I am doing.

Don't put the unicode stuff in the XML window - that should already be encoded. Notice the XML header? It states: encoding="utf-8", which means that the content of that file is already encoded into UTF-8. You're pasting non-encoded text, so it won't work.

If you have unicode stuff in the database, Dabo will handle it properly, and write the sample TestCursor? in a properly encoded format.