xp
xp copied to clipboard
Specifying file encoding
When using non-ASCII characters in .xp
files with Python code blocks, I have to specify,
code.py:
# -*- coding: UTF-8 -*-
...
for every Python code block.
It would be convenient to specify a single encoding for the whole file. (Bash and GnuPlot don't need the encoding specified, as far as I know, but as support for other languages is added in, it would be nice to have a universal mode for specifying the encoding of a file, once, that applies to all code blocks in the file.)
Bringing this issue back to life. I think we'll follow python's convention of requiring the first (or second) line of a pipeline to contain a coding designation. This will then be passed into the different code block implementations on execution.
After some thought, I believe it's only Python 2.7 that requires encodings beyond ASCII to be specified...bite the bullet and switch over to Python 3?
Following up on our discussion, it's not clear whether this is a feature that's needed and, if so, how exactly it should be handled (should xp have it's own policy, like Python 3, for how it handles this, or should a declaration system be possible?). We'll leave it for later and see if the need and use case becomes clearer.