ScribusGenerator icon indicating copy to clipboard operation
ScribusGenerator copied to clipboard

Color mappings fail for csv in UTF8-encoding and color mapping in first column

Open tofalemo opened this issue 7 years ago • 2 comments

Scribus version: 1.5.4 CSV encoding: UTF8 Area: Color mapping

Color mappings fail when csv is saved as UTF8 and color mapping is in first column.

This seems to be because the first column gets prefixed by "\xef\xbb\xbf"

Example VARNAMES [['\xef\xbb\xbfdummy', 'bgcolor', 'name', 'text', 'points', 'level', 'symbolimage']

Workaround Add dummy column first in csv.

Attached example with dummy column. Cards.zip

tofalemo avatar Oct 16 '18 21:10 tofalemo

Hello @tofalemo

EF BB BF in hexadecimal is the UTF-8 BOM: http://www.unicode.org/faq/utf_bom.html#BOM I guess your CSV editor (is it excel?) did not ask if you wanted to export your data as CSV with BOM or without BOM.

I'll test if using python-unicodecsv instead of the python native csv library solves this issue and works in all cases.

berteh avatar Nov 19 '18 13:11 berteh

or yet better (as a note to self to test), per https://tobywf.com/2017/08/unicode-csv-excel/

with open('test.csv', 'w', encoding='utf-8-sig', newline='') as fp:

berteh avatar Nov 19 '18 13:11 berteh

seems to be fixed by updating to latest (python3) script and scribus. kindly test and get back in touch if you still experience the problem.

berteh avatar Jun 08 '24 23:06 berteh