Skip to content

Adding .set_chars attribute with non-ASCII array seems to fail #17

@GLMeece

Description

@GLMeece

I very much like this module, but I was hoping to use either code page 437 (standard for Windows command shell) or the Unicode equivalent for box drawing.

Example code:

import texttable as ttbl
my_table = ttbl.Texttable()

# This causes a failure!
cp_437_borders = ['─', '│', '┼', '═'] # Code Page 437 box drawing characters
my_table.set_chars(cp_437_borders)
# returns: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

# This fails as well!
cp_437_borders = ['─', '│', '┼', '═'] # Unicode box drawing characters
my_table.set_chars(cp_437_borders)
# returns: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
# However, this would work:
ascii_fun_borders = ['~', '/', 'X', '#']
my_table.set_chars(ascii_fun_borders)

I am relatively new to the Python world. I've tried changing the coding at the beginning of my module, but that doesn't seem to help. These are the two variants I tried:

# -*- coding: cp437 -*-

or

# -*- coding: utf-8 -*-

Thoughts/suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions