xp icon indicating copy to clipboard operation
xp copied to clipboard

Specifying file encoding

Open hardik-vala opened this issue 8 years ago • 3 comments

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.)

hardik-vala avatar Jun 29 '16 22:06 hardik-vala

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.

druths avatar Jul 27 '16 15:07 druths

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?

hardik-vala avatar Jul 27 '16 15:07 hardik-vala

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.

druths avatar Jul 27 '16 16:07 druths