You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lottie export failure with specific locale setting in Windows 10 #3418
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:
Open 'Region' window by clicking 'Control Panel' - 'Clock and Region' - 'Region / 'Change date, time, or number formats'
Click 'Change system locale...' in 'Administrative' tab to open 'Region Settings'
Change the 'Current System Locale' to 'Japanese (Japan)'
Reboot may be needed.
Then, try the following steps to export lottie:
Open any .sif or .sifz files
Click on 'File' - 'Export...' to open dialog
Select 'Lottie HTML Preview (.html)' or 'Lottie HTML Preview without variable widths (.html)' as a format and click 'Save' to export
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.
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)
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.
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.
Activity
ice0 commentedon Sep 8, 2024
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)
jonnity commentedon Sep 8, 2024
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:
.siffile: AnimationFor3418.sif.gz.sifzfile: AnimationFor3418.sifz.gz.ice0 commentedon Sep 9, 2024
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.fix: Lottie export failure with Japanese locale setting in Windows
jonnity commentedon Sep 9, 2024
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.pyto setencoding="utf-8"in the same way as you did forlottie-exporter.py, and the 'Lottie HTML Preview without variable widths (.html)' export works fine as well.fix: Lottie export failure with Japanese locale setting in Windows
ice0 commentedon Sep 14, 2024
Nice catch! Thank you!
fix: Lottie export failure with Japanese locale setting in Windows (#…