jowave/vcard2to3

Script crashes when using utf-8 characters

Leon5x opened this issue · 2 comments

The script crashes when trying to write a file, when the vcf file contains names with special characters like https://de.wikipedia.org/wiki/%C5%81.

This can be fixed with changing line 136 in vcard2to3.py from

with open(args.infile) as infile, open(out_name, 'w', newline='\r\n') as outfile:

to

with open(args.infile) as infile, open(out_name, 'w', newline='\r\n', encoding='utf-8') as outfile:

I have added a command-line option to specify the output file encoding. You can run

python3 vcard2to3.py --out_encoding=utf-8 input.vcf

Can you check, if this works for you? The encoding was not an issue for me, because the platform encoding is already utf-8 on my system.

Perfect, thanks a lot!
Now it even works without stating the command line option for the utf-8 encoding.