question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The file name is Chinese. I encountered an error.

See original GitHub issue

It’s great. it allows me to sort out my videos faster. I love it. But I have a problem. when the file name is in Chinese, it doesn’t work. When I renamed him English, it worked again.

 amy@AMYS-MBP  ~  vcsi 你好_世界.mp4 \
-t \
-w 850 \
-g 3x5 \
--end-delay-percent 20 \
-o output.png
Processing 你好_世界.mp4...
Sampling... 15/15
Composing contact sheet...
Traceback (most recent call last):
  File "/usr/local/bin/vcsi", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/vcsi/__init__.py", line 3, in main
    vcsi.vcsi.main()
  File "/usr/local/lib/python3.7/site-packages/vcsi/vcsi.py", line 1451, in main
    process_file(filename, args)
  File "/usr/local/lib/python3.7/site-packages/vcsi/vcsi.py", line 1532, in process_file
    image = compose_contact_sheet(media_info, selected_frames, args)
  File "/usr/local/lib/python3.7/site-packages/vcsi/vcsi.py", line 862, in compose_contact_sheet
    template_path=args.metadata_template_path)
  File "/usr/local/lib/python3.7/site-packages/vcsi/vcsi.py", line 785, in prepare_metadata_text_lines
    text=remaining_chars)
  File "/usr/local/lib/python3.7/site-packages/vcsi/vcsi.py", line 749, in max_line_length
    text_width = 0 if len(text_chunk) == 0 else metadata_font.getsize(text_chunk)[0]
  File "/usr/local/lib/python3.7/site-packages/PIL/ImageFont.py", line 112, in getsize
    return self.font.getsize(text)
UnicodeEncodeError: 'latin-1' codec can't encode character '\u4f60' in position 0: ordinal not in range(256)

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
amietncommented, Apr 15, 2019

Okay, I believe this happens because the default system font does not support unicode characters. Let’s see if this theory is correct.

Can you try running vcsi with a TTF font that supports unicode and let me know if that changes anything? For example:

$ vcsi 你好_世界.mp4 \
-t \
-w 850 \
-g 3x5 \
--end-delay-percent 20 \
-o output.png \
--timestamp-font /Library/Fonts/SOME_FONT_WITH_UNICODE_SUPPORT.ttf \
--metadata-font /Library/Fonts/SOME_FONT_WITH_UNICODE_SUPPORT.ttf
Read more comments on GitHub >

github_iconTop Results From Across the Web

Chinese characters file and folder names cannot be ...
The issue is with displaying MS office file names in Chinese (and folder names too) when I search for files using File Explorer, ......
Read more >
can not load resources with file name containing Chinese ...
I recently set up a new CKAN instance (package install) for the community and found when I uploaded a file with a file...
Read more >
KB45114: File name with more than 11 Chinese characters ...
When a report with more than 11 Chinese characters in name is exported to PDF, the file name is truncated to 11 characters,...
Read more >
Problem opening PDF file in Chinese file name?
Error I am getting is : There was an error opening this document. The filename, directory name, or volume label syntax is incorrect."...
Read more >
Unable to load Chinese file name as attachment
Hi All, We would like to seek your advice for the issue we encountered. We are not able to upload chinese file name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found