UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Issue #334 resolved
Владислав created an issue

Comments (25)

  1. Marcin Kuzminski repo owner

    traceback doesn't show a lot, can you post a steps to reproduce ? Non-ascii group name ?

  2. Владислав reporter
    1. INSERT INTO `groups` (`group_id`, `group_name`, `group_parent_id`, `group_description`) VALUES (1, 'Группа-репозиториев', NULL, 'Специальная группа репозиториев');
    2. Open start page and get error /home/nuklea/workspace/rhodecode/rhodecode/rhodecode/templates/index_base.html, line 37: ${h.link_to(gr.name,url('repos_group_home',group_name=gr.group_name))}

    Anything else?

  3. Marcin Kuzminski repo owner

    Cannot confirm this, tried both insert and adding from web interface works fine for me.

  4. Владислав reporter

    I'm debug that in PyCharm and get some results (see attach). Is this normal, when variables such as group_name and group_description contents non latin characters has type str, but no unicode?

  5. Владислав reporter

    SHOW VARIABLES LIKE 'character_set%%'

    "character_set_client";"utf8"
    "character_set_connection";"utf8"
    "character_set_database";"utf8"
    "character_set_filesystem";"binary"
    "character_set_results";"utf8"
    "character_set_server";"utf8"
    "character_set_system";"utf8"
    "character_sets_dir";"/usr/share/mysql/charsets/"
    
  6. Владислав reporter

    Yep, some error at line 60: ${h.link_to(name,h.url('summary_home',repo_name=name),class_="repo_name")}

  7. Владислав reporter

    I'll try get that:

    1. show create database
    2. show create table
    3. select @@CHARACTER_SET_CLIENT

    and show u, maybe helps.

  8. Владислав reporter

    Nothing changes =( Btw, I tried use rhodecode (v1.3.2) with postgresql at other workstation. Get same error.

  9. Marcin Kuzminski repo owner

    I just realized that in the traceback you posted there are webhelpers 1.2 listed, try to upgrade to 1.3 ?

  10. Владислав reporter
    1. $ hg pull -u https://bitbucket.org/marcinkuzminski/rhodecode
    2. $ python setup.py develop
    3. $ pip install webhelpers==1.3
    4. $ paster upgrade-db development.ini
    5. $ echo "INSERT INTO groups (group_id, group_name, group_parent_id, group_description) VALUES (1, 'Группа-репозиториев', NULL, 'Специальная группа репозиториев');" | mysql -D rhodecode
    6. Going to http://127.0.0.1:5000/_admin/repos_groups
    7. Get UnicodeDecodeError: http://pylonshq.com/tracebacks/8e2401904864e6e97a729c86e5e2bbb9
  11. Владислав reporter

    Additionally info:

    • rhodecode CREATE DATABASE `rhodecode` /*!40100 DEFAULT CHARACTER SET utf8 */
    • groups CREATE TABLE `groups` (\n `group_id` int(11) NOT NULL AUTO_INCREMENT,\n `group_name` varchar(255) NOT NULL,\n `group_parent_id` int(11) DEFAULT NULL,\n `group_description` varchar(10000) DEFAULT NULL,\n PRIMARY KEY (`group_id`),\n UNIQUE KEY `group_id` (`group_id`),\n UNIQUE KEY `group_name_2` (`group_name`),\n UNIQUE KEY `group_name` (`group_name`,`group_parent_id`),\n KEY `group_parent_id` (`group_parent_id`)\n) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8
    • @@CHARACTER_SET_CLIENT utf8
  12. Marcin Kuzminski repo owner

    In latest commits i wrapped the parts from your traceback with map to unicode, as I'm not able to reproduce your issue in any way, please check if that helps

  13. Log in to comment