Move fallback decoding of safe_unicode into rhodecode config

Issue #212 resolved
Former user created an issue

There is a problem with viewing the contents of files in non-Unicode encoding (cp1251). I see only question marks. How to resolve this problem?

Comments (8)

  1. Marcin Kuzminski repo owner
    • changed status to open

    You should really use utf-8, if most of (or all) files are cp1251, you can patch safe_unicode function in sources to use cp1251 instead of utf8

  2. Former user Account Deleted

    Sorry, but I've resoled this problem :-) I just made a tiny changes to the file "/usr/local/lib/python2.7/dist-packages/RhodeCode-1.1.8-py2.7.egg/rhodecode/lib/"

    --- 2011-06-16 12:17:23.000000000 +0600
    +++ 2011-06-17 18:04:40.000000000 +0600
    @@ -76,6 +76,9 @@
             u_str = unicode(_str, from_encoding)
         except UnicodeDecodeError:
    -        u_str = unicode(_str, from_encoding, 'replace')
    +        try:
    +            u_str = unicode(_str, from_encoding, 'strict')
    +        except UnicodeDecodeError:
    +            u_str = unicode(_str, 'cp1251', 'replace')
         return u_str

    and the similar changes to the file "/usr/local/lib/python2.7/dist-packages/vcs/utils/"

  3. Log in to comment