Kallithea issues archive

Issue #209: Improper display of locale Ru

Reported by: Evgeniy Bondarenko
State: open
Created on: 2016-04-13 14:37
Updated on: 2016-05-13 17:13

Description

When change string config file, from:

default_encoding = utf8

to

default_encoding = ru_RU.utf8

I have error below, but locale installed in OS. How to fix the incorrect display of the locale in the web interface?

2016-04-13 14:32:43.248 INFO  [kallithea.model] initializing db for sqlite:////kallithea/config/kallithea.db?timeout=60
2016-04-13 14:32:43.249 INFO  [kallithea.lib.auth] getting information about all available permissions
Traceback (most recent call last):
  File "/usr/local/bin/paster", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python2.7/dist-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/local/lib/python2.7/dist-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/usr/local/lib/python2.7/dist-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/local/lib/python2.7/dist-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/usr/local/lib/python2.7/dist-packages/paste/script/serve.py", line 329, in loadapp
    **kw)
  File "/usr/local/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/local/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/local/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/local/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/local/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/kallithea/kallithea/kallithea/config/middleware.py", line 56, in make_app
    config = load_environment(global_conf, app_conf)
  File "/kallithea/kallithea/kallithea/config/environment.py", line 117, in load_environment
    repos_path = make_ui('db').configitems('paths')[0][1]
  File "/kallithea/kallithea/kallithea/lib/utils.py", line 368, in make_ui
    ui_val = safe_str(ui_.ui_value)
  File "/kallithea/kallithea/kallithea/lib/utils2.py", line 264, in safe_str
    return unicode_.encode(enc)
LookupError: unknown encoding: ru_RU.utf8
# locale -a
C
C.UTF-8
POSIX
en_US.utf8
ru_RU.utf8

# dpkg-reconfigure locales
Generating locales...
  en_US.UTF-8... up-to-date
  ru_RU.UTF-8... up-to-date
Generation complete.

System:

Kallithea version:
    0.3.1 Check for updates
Kallithea configuration file:
    /kallithea/config/kallithea.ini
Python version:
    2.7.6
Platform:
    Linux-3.13.0-77-generic-x86_64-with-Ubuntu-14.04-trusty
Версия Git:
    1.9.1
Git path:
    git
Upgrade info endpoint:

    Note: please make sure this server can access this URL.

Python Packages
amqplib     1.0.2
anyjson     0.3.3
argparse    1.2.1
Babel   1.3
Beaker  1.6.4
celery  2.2.10
chardet     2.0.1
colorama    0.2.5
decorator   4.0.9
docutils    0.11
dulwich     0.9.9
FormEncode  1.2.6
funcsigs    0.4
html5lib    0.999
Kallithea   0.3.1
kombu   1.5.1
Mako    1.0.0
Markdown    2.2.1
MarkupSafe  0.23
mercurial   3.7.2
mock    1.3.0
MySQL-python    1.2.5
nose    1.3.7
Paste   2.0.3
PasteDeploy     1.5.2
PasteScript     2.0.2
pbr     1.8.1
pip     8.1.1
psycopg2    2.6.1
py-bcrypt   0.4
Pygments    2.1.3
Pylons  1.0.2
pyparsing   1.5.7
Python  2.7.6
python-dateutil     1.5
python-ldap     2.4.10
pytz    2016.1
repoze.lru  0.6
requests    2.2.1
Routes  1.13
setuptools  20.3
simplejson  3.8.2
six     1.10.0
SQLAlchemy  0.7.10
Tempita     0.5.2
urllib3     1.7.1
URLObject   2.3.4
waitress    0.8.8
WebError    0.13
WebHelpers  1.3
WebOb   1.1.1
WebTest     1.4.3
wheel   0.24.0
Whoosh  2.5.7
wsgiref     0.1.2

Attachments

screen-web.JPG

Comments

Comment by Andrej Shadura, on 2016-04-13 15:18

Why do you do this?

Comment by Andrej Shadura, on 2016-04-13 15:20

Use lang = variable instead. default_encoding specifies the default encoding used to convert from and to Unicode, just as the comment says, not the locale setting.

Comment by Evgeniy Bondarenko, on 2016-04-13 17:06

lang = ru

variable already set, but error is still exit.

On screenshot you may see language (Ru) and bad encoding

Comment by Evgeniy Bondarenko, on 2016-04-13 17:07

error encoding

Comment by Andrej Shadura, on 2016-04-13 17:12

Don't change default_encoding, keep it to the default value.

Comment by Andrej Shadura, on 2016-04-13 17:16

It works here: 2016-04-13_19-15-09.png 2016-04-13_19-15-16.png

Comment by Evgeniy Bondarenko, on 2016-04-13 17:48

error-in-comment-message.JPG

How do I fix the display of the symbols in the comments in the proper encoding?

Comment by Andrej Shadura, on 2016-04-13 17:51

Okay, some more questions to you:

  1. What VCS are you using, Git or Mercurial?
  2. What encoding is it using for storing commit messages?

Comment by Evgeniy Bondarenko, on 2016-04-13 17:59

  1. Mercurial
  2. I think ru_RU.UTF-8 or CP1251, but do not know how to check. How to check encoding commit messages (windows hg client)?

Thank you for taking time to my question.

Comment by NestorIT, on 2016-05-13 17:13

Hi, I have the same problem of use Mercurial with Kallithea-0.3.2. on Ubuntu 14.04.4 LTS Server. Comments of Mercurial commits in russian language does not correctly display. It happens when I run Kallithea from WSGI dispatch script for Apache webserver or as service based on kallithea-daemon-debian sample file: sudo service kallithea start where kallithea is the same kallithea-daemon-debian sample file. But if I start Kallithea as sudo /etc/init.d/kallithea start it success works. May be it will also help you for solving the problem.