1452: convert_to_utf8() function bug

cmoh****@gmai***** (Google Code) (Is this you? Claim this profile.)
Feb. 17, 2010
What version are you running?
version: 1.1 alpha 2
option: repository encoding option as 'euckr,cp949'.

What's the URL of the page containing the problem?


What steps will reproduce the problem?
1. upload diff file containing some euckr characters(as "patch.txt").
2. view diff.
3. euckr characters are displayed as broken.

What is the expected output? What do you see instead?
unbroken euckr characters containing like "김수한무거북이와두루미"

What operating system are you using? What browser?
Linux 2.6 x86_64, Firefox3.5

Please provide any additional information below.
I fixed convert_to_utf8() as below. It worked.
--------------------------------------------------------------------------
*** diffutils.py.old    Thu Jan  7 19:03:28 2010
--- diffutils.py.new    Thu Jan  7 19:03:35 2010
***************
*** 204,210 ****
              for e in enc.split(','):
                  try:
                      u = unicode(s, e)
!                     return u.encode('utf-8')
                  except UnicodeError:
                      pass
              raise Exception(_("Diff content couldn't be converted to UTF-8 "
--- 204,211 ----
              for e in enc.split(','):
                  try:
                      u = unicode(s, e)
!                     return u
!                     #return u.encode('utf-8')
                  except UnicodeError:
                      pass
              raise Exception(_("Diff content couldn't be converted to UTF-8 "
--------------------------------------------------------------------------
Index: test.cpp
===================================================================
--- test.cpp	(revision 9671)
+++ test.cpp	(working copy)
@@ -1,3 +1,4 @@
-
+����ѹ��ź��̿͵η��
+KimSuHanMuGeoBugiDoroomi
 ###########################################################################
 
david
#1 david
This should be fixed in 1.5 beta 1
  • +Fixed