1121: "repository encoding setting" work incorrect

kohura1*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Nov. 28, 2009
What version are you running?
1.0rc2

What's the URL of the page containing the problem?
all "View Diff" pages like that.
/r/6/diff/#index_header

What steps will reproduce the problem?
1.View Diff
2.
3.

What is the expected output? What do you see instead?
If I set repository encoding setting correctly, but I saw broken character.
Review source code is Japanese Encoding.

What operating system are you using? What browser?
CentOS 5.2
Firefox 3

Please provide any additional information below.
attach patch
Index: reviewboard/diffviewer/diffutils.py
===================================================================
--- reviewboard/diffviewer/diffutils.py	(revision 1977)
+++ reviewboard/diffviewer/diffutils.py	(working copy)
@@ -201,8 +201,7 @@
         except UnicodeError:
             for e in enc.split(','):
                 try:
-                    u = unicode(s, e)
-                    return u.encode('utf-8')
+                    return unicode(s, e)
                 except UnicodeError:
                     pass
             raise Exception(_("Diff content couldn't be converted to UTF-8 "
chipx86
#1 chipx86
This is going to break a lot of setups out there. We do need to render it to utf-8.

What's the encoding code that you're using?

And what encoding mode does it show in your browser on that page? Make sure it's utf-8.
  • +NeedInfo
#2 kohura1*******@gmai***** (Google Code) (Is this you? Claim this profile.)
My repository is 'Shift_JIS' encoding.
And show utf-8 in my browser.

	
I felt like this.
If argument 's' is unicode and utf-8, this function returns a unicode. However, if 
's' is other encoding , this function returns utf-8 string.
Function name 'convert_to_utf8' is not exact.

david
#3 david
  • -NeedInfo
    +New
david
#4 david
  • -New
    +Fixed