Package: charm
Version: 1.9.1-2
Severity: important
Tags: patch


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages charm depends on:
ii  python                  2.6.6-3+squeeze5 interactive high-level object-orie
ii  python-feedparser       4.1-14           Universal Feed Parser for Python
ii  python-support          1.0.11           automated rebuilding support for P

charm recommends no packages.

charm suggests no packages.

-- no debconf information

I posted a blog entry to a wordpress 3.0.5 blog (with de language files) but i 
can't open or edit the entry with charm again. 
The following error message appears.

Traceback (most recent call last):
  File "/usr/bin/charm", line 14, in <module>
    ljcharm.main()
  File "/usr/share/charm/ljcharm.py", line 6220, in main
    jobj.do_metaweb(opts, resumeold, xpostfile, template, quick_opt)
  File "/usr/share/charm/ljcharm.py", line 5782, in do_metaweb
    self.main_blog(opts, resumeold, xpostfile, template, quick_opt)
  File "/usr/share/charm/ljcharm.py", line 5530, in main_blog
    self.blog_menu()
  File "/usr/share/charm/ljcharm.py", line 5483, in blog_menu
    repeat_ok = self.Blogger.blog_pick_edit_menu()
  File "/usr/share/charm/ljcharm.py", line 5768, in metaweb_pick_edit_menu
    return self.metaweb_get_post(server, entry["postid"])
  File "/usr/share/charm/ljcharm.py", line 5578, in metaweb_get_post
    return self.blog_get_entry(text, ttup)
  File "/usr/share/charm/ljcharm.py", line 5329, in blog_get_entry
    f.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 
64: ordinal not in range(128)



Obviously charm can't detect my local UTF-8 environment which causes python 
falling back to ascii. I am using special characters 
like german umlauts which are not displayed by ascii. 

I've read python >=3 is using a different mechanism and switches to unicode 
instead of ascii if it's not able to detect the correct locals.


Maybe there are two solutions:

1. Charm should depend on python >=3 which most likely solves this issue. (not 
tested and not recommended because charm should work with 
python >=2.5 too)

2. Force charm to encode all input with UTF-8

change the following lines in charm:

1129            mfile.write("%s=%s\n" % (k, self.Params[k].encode('UTF-8')))

2360            f.write("Subject:   " + self.Params["subject"].encode('UTF-8') 
+ "\n")

5329            f.write(text.encode('UTF-8'))


So on my system i got rid of the bug but it could cause trouble on others and 
maybe it's not generic enough. Perhaps it helps someone. 

Regards
Markus



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to