Vyhľadajte odpoveď

Vyhnite sa podvodom s podporou. Nikdy vás nebudeme žiadať, aby ste zavolali alebo poslali SMS na telefónne číslo alebo zdieľali osobné informácie. Nahláste prosím podozrivú aktivitu použitím voľby “Nahlásiť zneužitie”.

Learn More

How does one set the default encoding to Unicode (UTF-8) in Firefox?

  • Žiadne odpovede
  • 1 má tento problém
  • 4 zobrazenia
more options

To simply rephrase the title, how does one set the fallback text encoding to UTF-8 in Firefox?

Before you rush with an answer, please take a moment to consider what the question really is about. I have noticed this question being asked multiple times. Each time it's eventually not answered because, invariably, someone deflects the thread with an answer that does not directly address the concern, probably because the author of the reply misunderstood the question. It's usually not a wrong answer, it's just an answer to some other question maybe related to this one. So please, if you cannot provide a direct answer, let the question stick out so that someone realizes that in 2018 Firefox still has this problem. It's not a huge issue, it's more of an annoyance, one that should be easy to fix, but first someone has pick up on the nuances between the need of the end user and the project's UX goals. It's especially important because it does not make sense that a modern browser would only accept legacy encodings as default. It thus sorely looks like an oversight.

First, a definition. A user selected default text encoding as it is understood here is a valid encoding picked by the end user as the one that Firefox should revert to, after all its attempt at automatically detecting a document's encoding have failed. I emphasize on the fact that user selected default effectively means that we're not dealing anymore with automatic detection. It's about what should happen when the latter has completely failed.

The only choices currently given when trying to set a fallback text encoding in Firefox are all legacy encodings. I'm running FF 57.0.1 on Ubuntu. You can access the menu from Edit > Preferences > Font & Colors > Advanced > Text Encoding For Legacy Content > Fallback Text Encoding. In addition to the legacy encodings present in the list there's also one option that supposedly instructs the browser to rely on the Default For Current Locale, I'm not sure if what is meant is the machine's locale, but it certainly doesn't seem to be respected.

I have tested this by creating a small text file with a text editor (vim) to which I instructed to encode the text in UTF-8. I then opened it with Firefox and Chrome. Firefox loaded it with the "Western" encoding, while Chrome accurately detected the UTF-8 encoding.

The screenshot attached below shows the output respectively from Firefox, Chrome, and the locale settings.


Now, as I've mentioned earlier the typical answers to this specific question have been unhelpful. I'm providing here some examples and explain why they're off the mark. At first they seem to address the question, but if you pay attention you realize that they're in fact answering other, maybe related, questions:

- Go to View, select Text-Encoding and pick Unicode. This answer is unhelpful because it instructs me on how to manually choose the encoding. What I want is for Firefox to just pick UTF-8 when it can't figure out what to do.

- If the document's headers do not specify the encoding then the browser has no way to know what encoding to choose. Exactly, but this question is not about nudging the browser with document headers and meta (automatic detection). It's about instructing it on how to work with documents that have none of that info (user selected default). There's a user selectable list of possible encodings Firefox can fallback to in such situations. I want UTF-8 added to that list. How do I do that?

- Normally the http server sends headers to indicate the encoding. Again, when there are no servers, there are no headers. If Firefox is directed to load file:///my/path/myfile.txt and fails to detect what the encoding is, it still has to pick one. At that point, I want it to remember my preference for UTF-8. If there's a way to do this presently it's not clear.

- Set the BOM on the file. This is just another way of saying headers, meta, and automatic detection. See my previous points about user selected defaults.

To simply rephrase the title, how does one set the fallback text encoding to UTF-8 in Firefox? Before you rush with an answer, please take a moment to consider what the question '''really''' is about. I have noticed this question being asked multiple times. Each time it's eventually not answered because, invariably, someone deflects the thread with an answer that does not directly address the concern, probably because the author of the reply misunderstood the question. It's usually not a wrong answer, it's just an answer to some other question maybe related to this one. So please, if you cannot provide a direct answer, let the question stick out so that someone realizes that in 2018 Firefox still has this problem. It's not a huge issue, it's more of an annoyance, one that should be easy to fix, but first someone has pick up on the nuances between the need of the end user and the project's UX goals. It's especially important because it does not make sense that a modern browser would only accept legacy encodings as default. It thus sorely looks like an oversight. First, a definition. A '''user selected''' default text encoding as it is understood here is a '''valid''' encoding picked by the end user as the one that Firefox should revert to, after all its attempt at automatically detecting a document's encoding have failed. I emphasize on the fact that ''user selected default'' effectively means that we're not dealing anymore with ''automatic detection''. It's about what should happen when the latter has completely failed. The only choices currently given when trying to set a fallback text encoding in Firefox are all legacy encodings. I'm running FF 57.0.1 on Ubuntu. You can access the menu from ''Edit > Preferences > Font & Colors > Advanced > Text Encoding For Legacy Content > Fallback Text Encoding''. In addition to the legacy encodings present in the list there's also one option that supposedly instructs the browser to rely on the ''Default For Current Locale'', I'm not sure if what is meant is the machine's locale, but it certainly doesn't seem to be respected. I have tested this by creating a small text file with a text editor (vim) to which I instructed to encode the text in UTF-8. I then opened it with Firefox and Chrome. Firefox loaded it with the "Western" encoding, while Chrome accurately detected the UTF-8 encoding. The screenshot attached below shows the output respectively from Firefox, Chrome, and the locale settings. ----- Now, as I've mentioned earlier the typical answers to this specific question have been unhelpful. I'm providing here some examples and explain why they're off the mark. At first they seem to address the question, but if you pay attention you realize that they're in fact answering other, maybe related, questions: - ''Go to View, select Text-Encoding and pick Unicode''. This answer is unhelpful because it instructs me on how to manually choose the encoding. What I want is for Firefox to just pick UTF-8 when it can't figure out what to do. - ''If the document's headers do not specify the encoding then the browser has no way to know what encoding to choose''. Exactly, but this question is not about nudging the browser with document headers and meta (automatic detection). It's about instructing it on how to work with documents that have none of that info (user selected default). There's a ''user selectable'' list of possible encodings Firefox can fallback to in such situations. I want UTF-8 added to that list. How do I do that? - ''Normally the http server sends headers to indicate the encoding''. Again, when there are no servers, there are no headers. If Firefox is directed to load ''file:///my/path/myfile.txt'' and fails to detect what the encoding is, it still has to pick one. At that point, I want it to remember my preference for UTF-8. If there's a way to do this presently it's not clear. - ''Set the BOM on the file''. This is just another way of saying headers, meta, and automatic detection. See my previous points about user selected defaults.
Priložené obrázky

Upravil(a) ekoka dňa