Weblate: Java Properties (UTF-16) using unicode escape sequence

Created on 10 Oct 2019  路  4Comments  路  Source: WeblateOrg/weblate

Describe the bug
I'm not sure if this is a bug, or just some kind of misconfiguration, but i have the following phenomenon: I have several components defined, some with "Java Properties (UTF-8)" and some with "Java Properties (UTF-16)" file format and files in the corresponding encoding.
After translating something from the UTF-16 component the translation files use unicode escape sequences instead of the unicode characters although the files are still in UTF-16 encoding (UCS-2 LE BOM) .
This behaviour does not apply when translating the UTF-8 components.

To Reproduce
Steps to reproduce the behavior:

  1. Checkin files in UTF-16 encoding containing unicode characters
  2. Translate those files
  3. Push changes to repository
  4. See error: UTF-16 files conaining unicode escape sequences

Expected behavior
The UTF-16 files should still contain the unicode characters instead of escape sequences.

Server configuration and status
./manage.py list_versions

  • Weblate 3.8

    • Python 3.7.4

    • Django 2.2.4

    • Celery 4.3.0

    • celery-batches 0.2

    • six 1.12.0

    • social-auth-core 3.2.0

    • social-auth-app-django 3.1.0

    • django-appconf 1.0.3

    • translate-toolkit 2.4.0

    • translation-finder 1.6

    • Whoosh 2.7.4

    • defusedxml 0.6.0

    • Git 2.19.1

    • Pillow 6.1.0

    • python-dateutil 2.8.0

    • lxml 4.4.1

    • django-crispy-forms 1.7.2

    • django_compressor 2.3

    • djangorestframework 3.10.2

    • user-agents 2.0

    • jellyfish 0.7.2

    • diff-match-patch 20181111

    • ruamel.yaml 0.16.5

    • Database backends: django.db.backends.mysql

    • Cache backends: default:RedisCache, avatar:FileBasedCache

    • Email setup: django.core.mail.backends.smtp.EmailBackend: 172.18.4.76

    • Celery: redis://127.0.0.1:6379, redis://127.0.0.1:6379, eager

    • Platform: Linux 4.15.0-64-generic (x86_64)

./manage.py check --deploy

ERRORS:
?: (weblate.E005) Celery is configured in the eager mode
HINT: https://docs.weblate.org/en/weblate-3.8/admin/install.html#celery

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions.

INFOS:
?: (weblate.I021) Error collection is not configured, it is highly recommended for production use
HINT: https://docs.weblate.org/en/weblate-3.8/admin/install.html#collecting-errors

bug translate-toolkit

Most helpful comment

Hmm, you're right, it still broken in some cases, https://github.com/translate/translate/pull/3921 should address it.

All 4 comments

Thank you for your report, the issue you have reported has just been fixed.

  • In case you see problem with the fix, please comment on this issue.
  • In case you see similar problem, please open separate issue.
  • If you are happy with the outcome, consider supporting Weblate by donating.

I applied your fix to my version 3.8 ttkit.py file, but the behaviour is still the same.

Hmm, you're right, it still broken in some cases, https://github.com/translate/translate/pull/3921 should address it.

Thank you very much! This fixes my problem.

Was this page helpful?
0 / 5 - 0 ratings