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.

UTF-8 not working in env variables

See original GitHub issue

file content of testfile:

my variable is {{ VAR }}

This is working: VAR="full of joy" j2 testfile outputs: my variable is full of joy

This is not working: VAR="full of ñ" j2 testfile outputs:

Traceback (most recent call last):
  File "/usr/local/bin/j2", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/j2cli/cli.py", line 124, in main
    sys.argv[1:]
  File "/usr/local/lib/python2.7/dist-packages/j2cli/cli.py", line 114, in render_command
    context
  File "/usr/local/lib/python2.7/dist-packages/j2cli/cli.py", line 54, in render_template
    .render(context) \
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/music/test/j2clitest", line 1, in top-level template code
    saludo: {{ hola }}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kolyptocommented, Dec 26, 2018

Fixed in the new release

0reactions
zoobabcommented, Jan 3, 2019

I can confirm it is fixed now on python2.7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UTF-8 not supported in environment variable? - Stack Overflow
Try, specify encoding in property source @PropertySource(value = "classpath:/myprop.properties", encoding="UTF-8").
Read more >
Missing UTF-8 support, environment variable LANG not set #279
Environment variable LANG not set, leading to missing UTF-8 support and Jenkins unable to handle non ASCII characters.
Read more >
article | How to set up a clean UTF-8 environment in Linux
The following variables can affect programs: LANG, LANGUAGE, LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_PAPER, LC_NAME, LC_ADDRESS ...
Read more >
Locale environment variables are not working with SSH
Locale environment variables are not working with SSH ... What if you leave LC_ALL empty and set LANG to C or C.UTF-8?
Read more >
Set the NLS_LANG Environment Variable to UTF8
1 Set the NLS_LANG Environment Variable to UTF8. To set an Oracle client application like SQL*Plus to use the right encoding, you must...
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