Closed Bug 537455 Opened 15 years ago Closed 10 months ago

There is no way to pass file encoding to External Editor

Categories

(Firefox :: File Handling, enhancement)

x86_64
Linux
enhancement

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: Arsen.Shnurkov, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091225 Gentoo Firefox/3.5.6
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091225 Gentoo Firefox/3.5.6

Browser correctly detects file encodig.
If I setup GEdit as external editor, GEdit open file with default system encoding (which is wrong).

It would be nice to have the way pass encoding from FireFox to external editor.


Reproducible: Always
Reporter, are you still seeing this issue with Firefox 3.6.13 or later in safe mode or a fresh profile? If not, please close. These links can help you in your testing.
http://support.mozilla.com/kb/Safe+Mode
http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 2011-2-15]
I would guess this needs some support from the platform to implement.
Severity: normal → enhancement
Component: General → File Handling
QA Contact: general → file.handling
Whiteboard: [CLOSEME 2011-2-15]
Severity: normal → S3

Most platforms provide such support. It is called "ENVIRONMENT VARIABLES" (since 1979) from "Process Environment" (see https://en.wikipedia.org/wiki/Environment_variable ). Specfically System V x96_54 ABI use them, and Linux kernel implements that part of that standard.

https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf
see Figure 3.9: Initial Process Stack

«a C program begins executing at a function named main declared as:
extern int main ( int argc , char argv[ ] , char envp[ ] );
where
argc is a non-negative argument count
argv is an array of argument strings, with argv[argc] == 0
envp is an array of environment strings, terminated by a null pointer.»

Firefox developers should set dome variable, and document it's name, like Python developers did
with PYTHONIOENCODING variable (see https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING)

I propose the name "STDIO_ENCODING".

What do you think of the idea from comment 3?

Or is this bug a wontfix?

Flags: needinfo?(gijskruitbosch+bugs)

As the python documentation suggests, the environment variable is mostly ignored on Windows (unless you set a second env var which has other side effects).

More importantly, python specifies an encoding it receives information in. What we would need for this bug is for all the editors in question to support a (common specification) environment variable that would alter how all of those editors dealt with incoming files, that Firefox would then set. It's no use for Firefox to set it if the editor doesn't support it. Unless such an environment variable already exists that I am not aware of, I expect that trying to establish one is a fool's errand. It would take half a decade if not more to get most editors to adopt it even if you could quickly get to consensus of (a) the need for this to exist and (b) all the specifics of the name, format, etc.

I think it would probably be more useful for Firefox to have some kind of opt-in/opt-out option to re-encode files received as text/** into utf-8 if they are not correctly encoded (if you're on modern Linux I really hope that's your system encoding), which I hope could be accomplished losslessly (which is a property not satisfied by all arbitrary text encoding pairs). :jfkthame would know more definitively, I think. anyway, this comes under a similar heading as requests to re-encode webp files into more commonly supported formats like png or jpeg when downloaded.

It's not actually completely clear to me what the flow you're using is in comment 0 - what kind of file (HTML? Plaintext? Something else?) are you opening, and how was it downloaded / opened in an external editor (e.g. are you using "view source in external editor", or something else?).

Flags: needinfo?(jfkthame)
Flags: needinfo?(gijskruitbosch+bugs)
Flags: needinfo?(Arsen.Shnurkov)

(In reply to :Gijs (he/him) from comment #5)

It's not actually completely clear to me what the flow you're using is in comment 0 - what kind of file (HTML? Plaintext? Something else?) are you opening, and how was it downloaded / opened in an external editor (e.g. are you using "view source in external editor", or something else?).

This is unclear to me too.... I don't know actually know a way to ask Firefox to open a file in an external editor. Is this about saving (downloading) a file and then opening it, or what....?

More generally, in terms of encoding and conversion, I think :hsivonen would be the most knowledgeable person (but is currently away, I believe).

Flags: needinfo?(jfkthame)

Clear a needinfo that is pending on an inactive user.

Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE.

For more information, please visit BugBot documentation.

Flags: needinfo?(Arsen.Shnurkov)

Without more details I don't think we can move forward here.

Status: UNCONFIRMED → RESOLVED
Closed: 10 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.