Giter Site home page Giter Site logo

Comments (10)

zoffixznet avatar zoffixznet commented on July 3, 2024 1

Per World Wide Web Consortium:

HTTP 1.1 says that the default charset is ISO-8859-1. But there are too many unlabeled documents in other encodings, so browsers use the reader's preferred encoding when there is no explicit charset parameter.

IMO, for this particular purpose, assuming UTF-8 when nothing is specified is a good default.

from whateverable.

jonathanstowe avatar jonathanstowe commented on July 3, 2024 1

Somewhere I've done "try utf-8 and if that fails do iso-8859-1" which always seems like a reasonable compromise (though may be more effort than warranted in the circumstance,)

from whateverable.

AlexDaniel avatar AlexDaniel commented on July 3, 2024

So if it is not utf-8, should it blindly assume that it is utf-8? Or what kind of encoding should it expect?

from whateverable.

MasterDuke17 avatar MasterDuke17 commented on July 3, 2024

I'm in favor of trying anything with a mime type that contains 'perl' or 'text', and defaulting to utf-8 seems reasonable.

from whateverable.

AlexDaniel avatar AlexDaniel commented on July 3, 2024

👍

@MasterDuke17, so what's the current behavior if no encoding is specified?

from whateverable.

MasterDuke17 avatar MasterDuke17 commented on July 3, 2024

It will work without complaining.

from whateverable.

AlexDaniel avatar AlexDaniel commented on July 3, 2024

more specifically it will default to utf-8. OK.

from whateverable.

AlexDaniel avatar AlexDaniel commented on July 3, 2024

I want to write a test for this, but is there any link that will be reliably giving a page with text/plain till the end of our days?

from whateverable.

zoffixznet avatar zoffixznet commented on July 3, 2024

Something on http://httpbin.org/ ? Didn't see an option to generate custom content-type when I skimmed the page though

from whateverable.

AlexDaniel avatar AlexDaniel commented on July 3, 2024

@JJ does it really test it though? I think github correctly sets utf-8 so this has never been an issue with github.

from whateverable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.