Skip to content

Lottie export failure with specific locale setting in Windows 10 #3418

Open

Description

@jonnity

Describe the bug
lottie-exporter fails to export an html file for previewing lottie on Windows 10 in Japanese environment.
This error seems to occur because the default encoding for Python when reading files is based on the locale setting of the system.
Although this issue is caused by the environment, I think it can be solved by specifying the encoding on the Synfig side, so I will report it.

To Reproduce
As a precondition, the Windows locale settings must be changed via following procedure:

  1. Open 'Region' window by clicking 'Control Panel' - 'Clock and Region' - 'Region / 'Change date, time, or number formats'
  2. Click 'Change system locale...' in 'Administrative' tab to open 'Region Settings'
  3. Change the 'Current System Locale' to 'Japanese (Japan)'
  4. Reboot may be needed.

Then, try the following steps to export lottie:

  1. Open any .sif or .sifz files
  2. Click on 'File' - 'Export...' to open dialog
  3. Select 'Lottie HTML Preview (.html)' or 'Lottie HTML Preview without variable widths (.html)' as a format and click 'Save' to export
  4. A dialog is popped up and following error is shown:
Traceback (most recent call last):
  File "{installedPath}\share\synfig\plugins\lottie-exporter\lottie-exporter.py", line 167 (1.5.3では"line 147"), in <module>
    out = gen_html(out)
  File "{installedPath}\share\synfig\plugins\lottie-exporter\lottie-exporter.py", line 92 (1.5.3では"line 75"), in gen_html
    bodymovin_script = f.read()
UnicodeDecodeError: 'cp932' codec can't decode byte 0x93 in position 30346: illegal multibyte sequence

Expected behavior
The lottie file will be exported.

System information:

  • OS: Windows 10 Home
  • OS version: 22H2
  • Synfig version: 1.5.3

Additional comments
The same problem occurred when I ran 'Plugins' - 'Export to lottie format' in Synfig ver. 1.4.5.

Workaround
To enable 'Beta: Use Unicode UTF-8 for worldwide language support' in 'Region Settings' (changed in preparation for reproducing) make Synfig be able to export the HTML file.
And, I believe any of the other methods would work if they can change the default encoding settings in Python.

Activity

  1. ice0 commented on Sep 8, 2024

    @ice0
    Collaborator

    Hi!
    Does this happen to all files or with specific ones?
    Can you create a test file (just with circle, for example) and attach it here? (you need to zip it first)

  2. moved this to Planned in 1.5.4on Sep 8, 2024
  3. jonnity commented on Sep 8, 2024

    @jonnity
    Author

    Hi! Thank you for the comment.

    This occurs to all files I far as I checked.
    However, final confirmation was made in the following files:

  4. ice0 commented on Sep 9, 2024

    @ice0
    Collaborator

    lottie-exporter.zip

    Can you test with this file?
    You need to unzip it and replace the same one in <Synfig_Studio_folder>\share\synfig\plugins\lottie-exporter\ folder.

  5. jonnity commented on Sep 9, 2024

    @jonnity
    Author

    Thank you for providing the fix.

    After replacing the existing lottie-exporter.py, the 'Lottie HTML Preview (.html)' export works correctly, even with the same system locale setting that previously caused the error.

    Additionally, I modified export_without_variable_width.py to set encoding="utf-8" in the same way as you did for lottie-exporter.py, and the 'Lottie HTML Preview without variable widths (.html)' export works fine as well.

  6. ice0 commented on Sep 14, 2024

    @ice0
    Collaborator

    Additionally, I modified export_without_variable_width.py to set encoding="utf-8" in the same way as you did for lottie-exporter.py, and the 'Lottie HTML Preview without variable widths (.html)' export works fine as well.

    Nice catch! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Planned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions