Cubic - App fails with invalid text encoding

Asked by mungewell

Running on Xubuntu 18.04, running the cubic app fails at several points due to the encoding of messages... took me multiple cycles to edit them out sufficiently to complete the process of build a ISO (which actually for another reason).

Not sure what the intent of '\u2022' is... but it's not happy.

Shows as a 'bullet' here:
https://bazaar.launchpad.net/~cubic-wizard/cubic/release/view/head:/usr/share/cubic/utilities/logger.py#L66

Terminal has a default encoding of 'UTF-8'.
--
simon@thevoid:~/livecdtmp$ cubic

Cubic - Custom Ubuntu ISO Creator

Traceback (most recent call last):
  File "/usr/share/cubic/cubic.py", line 53, in <module>
    import navigator
  File "/usr/share/cubic/navigator.py", line 149, in <module>
    from utilities import displayer
  File "/usr/share/cubic/utilities/displayer.py", line 52, in <module>
    from utilities import model
  File "/usr/share/cubic/utilities/model.py", line 46, in <module>
    application.directory = None
  File "/usr/share/cubic/utilities/fields.py", line 71, in __setattr__
    logger.log_value('Set %s %s' % (self.name, key.replace('_', ' ')), value)
  File "/usr/share/cubic/utilities/logger.py", line 66, in log_value
    _log_value_hanging(column_a_text, column_b_text, column_a_initial_indent=' \u2022 ', column_a_subsequent_indent=' ')
  File "/usr/share/cubic/utilities/logger.py", line 232, in _log_value_hanging
    print('{}{}'.format(column_a_line, column_b_line))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2022' in position 2: ordinal not in range(128)
--

--
simon@thevoid:~/livecdtmp$ dpkg --list | grep cubic
ii cubic 2020.10-35-release~202010230044~ubuntu18.04.1 all Wizard to create a customized Ubuntu Live CD image.

simon@thevoid:~/livecdtmp$ lsb_release -rd
Description: Ubuntu 18.04.3 LTS
Release: 18.04

Question information

Language:
English Edit question
Status:
Answered
For:
Cubic Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Cubic PPA (cubic-wizard) said :
#1

If you encounter an error like:

    UnicodeEncodeError: 'ascii' codec can't encode character '\u2022'

This means you do not have UTF-8 support setup on your system.

Cubic requires UTF-8.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#2

Ensure you have the locales package installed, and check that your system supports UTf-8.

    $ $ dpkg -s locales | grep 'Package\|Version'
    $ echo $LC_CTYPE
    $ echo $LANG
    $ locale
    $ locale charmap
    $ cat /etc/default/locale
    $ cat /etc/rc.conf
    $ cat /etc/locale.conf
    $ grep "^[^#;]" /etc/locale.gen
    $ python3 --version
    $ python3 -c 'import sys; print(sys.version_info); print(sys.stdout.encoding)'

Revision history for this message
Cubic PPA (cubic-wizard) said :
#3

Your output should look something like this.
Notice that all output shows "UTF-8".

$ echo $LC_CTYPE

$ echo $LANG
    en_US.UTF-8

$ locale
    LANG=en_US.UTF-8
    LANGUAGE=
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=

$ locale charmap
    UTF-8

$ cat /etc/default/locale
    # File generated by update-locale
    LANG="en_US.UTF-8"

$ cat /etc/rc.conf
    cat: /etc/rc.conf: No such file or directory

$ cat /etc/locale.conf
    cat: /etc/locale.conf: No such file or directory

$ grep "^[^#;]" /etc/locale.gen
    en_US.UTF-8 UTF-8

$ python3 --version
    Python 3.8.5

$ python3 -c 'import sys; print(sys.version_info); print(sys.stdout.encoding)'
    sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
    utf-8

Revision history for this message
Cubic PPA (cubic-wizard) said :
#4

If you do not have UTF-8 support, follow these instructions.
(Replace "en_CA" in these instructions with the correct value for your locale).

(1)

$ sudo apt install locales

(2)

$ sudo dpkg-reconfigure locales

    Use <Page Up>, <Page Down>, <Up Arrow>, <Down Arrow> to navigate lists.
    Use <Space Bar> to select or unselect list items.
    Use <Tab> to switch between lists and buttons.
    Use <Left Arrow>, <Right Arrow> to switch between buttons.
    Use <Enter> to "Click" a selected Button.

(3)

On the 1st page "choose which locales to generate":

    Press the <Space Bar> to select "en_CA.UTF-8 UTF-8"
    Press the <Space Bar> to **UNSELECT** en_"CA ISO-8859-1"
    Continue to page through the list and ensure everything else is **Unselect**.

        [ ] en_CA ISO-8859-1
        [*] en_CA.UTF-8 UTF-8
        [ ] en_US.UTF-8 UTF-8

    (You may be able to select other locales, but do not select anything that doesn't say "UTF-8").

    Select "OK" to go to the next page.

(4)

On the 2nd page, "select the default language for the entire system":

    Scroll down and select "en_CA.UTF-8"

        en_CA.UTF-8

    (You can only select one default locale; make sure it says "UTF-8").

    Select "OK" to go to the next page.

(5)

You will see the following output:

    sxubuntu@xubuntu:~$ sudo dpkg-reconfigure locales
    Generating locales (this might take a while)...
    bn_BD.UTF-8... done
    .
    .
    .
    zh_SG.UTF-8... done
    Generation complete.

(6)

Reboot (or Logout / Login)

Can you help with this problem?

Provide an answer of your own, or ask mungewell for more information if necessary.

To post a message you must log in.