Skip to content

added fetch get example for non-utf8 pages #2911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ProjectEli
Copy link

Still, some webpages do not follow standard UTF-8 encoding. As far as I know, fetch() does not support encoding options by default. Therefore, I added an example with error handling part (not already shown).

@CLAassistant
Copy link

CLAassistant commented Mar 9, 2022

CLA assistant check
All committers have signed the CLA.

@iliakan
Copy link
Member

iliakan commented Apr 14, 2022

Are there many pages in non-UTF in Korean (or Chinese)?

Is it a common way of using fetch, then?

@ProjectEli
Copy link
Author

ProjectEli commented Apr 14, 2022

Are there many pages in non-UTF in Korean (or Chinese)?

Yes. At least there are many Korean and Japanese websites that are not in UTF8, especially for some government websites. For Chinese, I don't have much experience. In practice, many people struggle with encodings when accessing those websites programatically.

Ideally, the owners of those websites should follow international standards. However, in most cases they don't want to change, or just give up management. From the user point of view, we want to deal with what's inside rather than the charset encoding. Therefore, this example will be meaningful for beginners to utilize without a deeper understanding on non-UTF8 encodings.

Is it a common way of using fetch, then?

I agree that this is not the intended usage of fetch. But we cannot decode those websites correctly through given methods in the document. In my opinion, it is worth including as a tutorial for practical use unless we find a better way of decoding.

@iliakan
Copy link
Member

iliakan commented Apr 14, 2022

So, for non-UTF Korean websites, when people use fetch, do they use it exactly as you say?

How did they cope before TextDecoder, I wonder? Did they use XMLHttpRequest?

@iliakan
Copy link
Member

iliakan commented May 3, 2022

up )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants