I'm trying to pull content from a web page and display it in a dHtmlBox.
The web page is encoded in UTF-8.  My Dabo app appears to be using cp1252 (I
printed self.Application.Encoding from the main form's afterInitAll method
and I get '1252').  I get the error shown below (variable 'filteredPage'
contains a portion of the web page, and it contains UTF-8 encoded
characters).

Traceback (most recent call last):
  File "C:\dabo\ui\uiwx\dControlMixin.py", line 27, in _onWxHit
    self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
  File "C:\dabo\ui\uiwx\dPemMixin.py", line 981, in raiseEvent
    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,
**kwargs)
  File "C:\dabo\lib\eventMixin.py", line 92, in raiseEvent
    bindingFunction(event)
  File "c:\documents and settings\dad\local settings\temp\tmpazysvh.py",
line 907, in onHit
    self.Form.dPanel.dPageFrame.EditPage.dHtmlBox.Source = filteredPage
  File "C:\dabo\ui\uiwx\dHtmlBox.py", line 169, in _setSource
    self.SetPage(val)
  File "C:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\html.py", line
1004, in SetPage
    return _html.HtmlWindow_SetPage(*args, **kwargs)
  File "C:\Python26\lib\encodings\cp1252.py", line 15, in decode
    return codecs.charmap_decode(input,errors,decoding_table)
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 4279:
character maps to <undefined>

Platform: Win
Python Version: 2.6.6 on win32
Dabo Version: Version 0.9.2; Revision ~5963
UI Version: 2.8.10.1 on wxMSW

How do I make my Dabo app use UTF-8 everywhere? (The user may want to copy
some of the text from the dHtmlBox and paste it into a dTextBox, and then
into an Sqlite DB -- the DB is already set for UTF-8 encoding.)

I tried setting self.Application.Encoding to 'Unicode' in the main form's
afterInitAll(), but I received 'AttributeError: can't set attribute.'   So
far I'm only using ClassDesigner (if that matters).  I'm pulling the web
page into the Dabo app using urllib.urlopen(). I then assigning a portion of
the page (filteredPage) to dHtmlBox.Source

-- Mark


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to