kopano-localize-folders



  • Hello.

    I just tried the new kopano-localize-folders command.
    First i created a test-user with german locales.

    Then i changed his store to english without any problems.
    After that i wanted to change back to german an got a traceback:

    root@srv:~# kopano-localize-folders -u user --lang en_GB.UTF-8 --verbose
    user
    user: Changing localized folder names to "en_GB.UTF-8"
    Running in verbose mode
    Changing MAPI "junk" -> Renaming "Junk E-Mail" to "Junk E-mail"
    Changing MAPI "tasks" -> Renaming "Aufgaben" to "Tasks"
    Changing MAPI "journal" -> Renaming "Journal" to "Journal"
    Changing MAPI "wastebasket" -> Renaming "Gelöschte Objekte" to "Deleted Items"
    Changing MAPI "inbox" -> Renaming "Posteingang" to "Inbox"
    Changing MAPI "sentmail" -> Renaming "Gesendete Objekte" to "Sent Items"
    Changing MAPI "outbox" -> Renaming "Postausgang" to "Outbox"
    Changing MAPI "calendar" -> Renaming "Kalender" to "Calendar"
    Changing MAPI "rss" -> Renaming "RSS Feeds" to "RSS Feeds"
    Changing MAPI "drafts" -> Renaming "Entwürfe" to "Drafts"
    Changing MAPI "contacts" -> Renaming "Kontakte" to "Contacts"
    Changing MAPI "notes" -> Renaming "Notizen" to "Notes"
    Changing MAPI "suggested_contacts" -> Renaming "Vorgeschlagene Kontakte" to "Suggested Contacts"
    root@srv:~#
    root@srv:~# kopano-localize-folders -u ullibasti --lang de_DE.UTF-8 --verbose
    user
    user: Changing localized folder names to "de_DE.UTF-8"
    Running in verbose mode
    Changing MAPI "junk" -> Renaming "Junk E-Mail" to "Junk E-Mail"
    Changing MAPI "tasks" -> Renaming "Aufgaben" to "Aufgaben"
    Changing MAPI "journal" -> Renaming "Journal" to "Journal"
    Traceback (most recent call last):
      File "/usr/sbin/kopano-localize-folders", line 113, in <module>
        main()
      File "/usr/sbin/kopano-localize-folders", line 103, in main
        print 'Changing MAPI "%s" -> Renaming "%s" to "%s"' % (mapifolder, folderobject.name, localizedname)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
    

    And what does the -m switch? I supposed that there are database modifications.

    Kind regards
    Basti


  • Translator

    I’m on Debian 8 and Kopano version 8.4.2.0-0. I got the (almost) the same when trying to use nb_NO
    kopano-localize-folders -u klaus --lang=nb_NO.UTF-8 --dry-run --verbose
    klaus
    klaus: Changing localized folder names to "nb_NO.UTF-8"
    Running in verbose mode
    Running in dry mode no changes will be made
    Traceback (most recent call last):
    File “/usr/sbin/kopano-localize-folders”, line 113, in <module>
    main()
    File “/usr/sbin/kopano-localize-folders”, line 103, in main
    print ‘Changing MAPI “%s” -> Renaming “%s” to “%s”’ % (mapifolder, folderobject.name, localizedname)
    UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 1: ordinal not in range(128)


  • Kopano

    @klausade said in kopano-localize-folders:

    UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 1: ordinal not in range(128)

    I’ve seen such errors popping up in the past when the specified locale was not installed.


  • Translator

    Sorry, forgot to mention, nb_NO is on the server.
    lavd@mail:~$ locale -a
    C
    C.UTF-8
    de_DE.utf8
    en_US.utf8
    nb_NO.utf8
    POSIX


  • Kopano

    @klausade but is it also used in your current session? I’ve seen such errors popping up when the current session was only using the c locale.


  • Translator

    @fbartels I would say “yes it used in the session”

    klaus@mail:~$  cat /etc/default/locale 
    #  File generated by update-locale
    LANG=nb_NO.UTF-8
    LANGUAGE="nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en"
    klaus@mail:~$ locale
    LANG=nb_NO.UTF-8
    LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en
    LC_CTYPE="nb_NO.UTF-8"
    LC_NUMERIC="nb_NO.UTF-8"
    LC_TIME="nb_NO.UTF-8"
    LC_COLLATE="nb_NO.UTF-8"
    LC_MONETARY="nb_NO.UTF-8"
    LC_MESSAGES="nb_NO.UTF-8"
    LC_PAPER="nb_NO.UTF-8"
    LC_NAME="nb_NO.UTF-8"
    LC_ADDRESS="nb_NO.UTF-8"
    LC_TELEPHONE="nb_NO.UTF-8"
    LC_MEASUREMENT="nb_NO.UTF-8"
    LC_IDENTIFICATION="nb_NO.UTF-8"
    LC_ALL=
    klaus@mail:~$ env|grep -i lang
    LANG=nb_NO.UTF-8
    LANGUAGE=nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en
    

  • Kopano

    @klausade then I’m out of immediate ideas.



  • Hello.

    I have the same behavior.

    The locale is installed:

    root@srv:~# locale -a
    C
    C.UTF-8
    de_AT.utf8
    de_DE.utf8
    POSIX
    

    I don’t get it why i can change the language to english but not back to german?

    Kind regards
    Basti


  • Kopano

    I made a ticket for this issue. https://jira.kopano.io/browse/KC-874

    Thanks!



  • The problem is that the script mixes byte and unicode strings. This means that python’s implicit conversion to ascii is triggered, and because the folder names contain characters that can’t be represented in ascii, an exception is thrown.

    The script probably has other hidden encoding bugs too. Unfortunately it’s really hard to get this right in Py2, I think the consensus is that the only way to really deal with it is to use unicode everywhere, converting at the “borders”.


  • Kopano

    Hi,

    Can you try the version on https://stash.kopano.io/projects/KSC/repos/core-tools/browse/localize-folders.py
    This should already have the fix for this.

    Kind regards,

    Robin



  • Hi Robin.

    I tested the new python script and this version works fine with the german locale.

    Thank you very much.

    Kind regards


Log in to reply
 

Looks like your connection to Kopano Community Forum was lost, please wait while we try to reconnect.