Repository navigation
Samples not language aware #29739
Description
Activity
It depends on your editor and its settings. If the file is saved as UTF-8, you shouldn't have such problems.
But I agree, this is too much.
my file saved as UTF-8
Wrap your sample code above in code blocks so that it's properly formatted. I cannot try unformatted code.
To generate the certificate and key for this example, run:
openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' \ -keyout localhost-privkey.pem -out localhost-cert.pemWhat happens if you use
'content-type': 'text/html; charset=utf-8'?What happens if you use
'content-type': 'text/html; charset=utf-8'?not work
Maybe there's something else wrong, then.
Let's wait for others to chime in.
i recheck 'content-type': 'text/html; charset=utf-8' work as expected :) typo :) was utf8
so i guess sample at page https://nodejs.org/dist/latest-v12.x/docs/api/http2.html under title "Server-side example" should be changed at line with code
'content-type': 'text/html',
with
'content-type': 'text/html; charset=utf-8',and sample become international friendly :)
google search 'content-type': 'text/html' site:nodejs.org should return zero :)
i tried search utf8 at site nodejs.org - it return many - maybe it not ok?
The thing is that the translators shouldn't have translated this in the first place, and secondly this should have been caught up in review.
But anyway mistakes happen so we are here to fix them, including yourself :)
I'm not sure what's the best solution. The easiest one would be to fix this specific snippet, but for the long term we probably need to standardize this.
/CC @Trott
@nodejs/i18n Opinions on how best to address this?
@wetndusty where's this snippet exactly on the website?
That's in the core @Trott
6 remaining items
- addedhttpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
on Sep 27, 2019 - addedhttp2Issues and PRs related to the http2 subsystem.Issues and PRs related to the http2 subsystem.and removedhttpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
on Sep 28, 2019 This is valid for many examples and not just this one https://nodejs.org/dist/latest-v12.x/docs/api/http2.html#http2_server_side_example. In my opinion we should either use
Content-Type: text/html; charset=utf-8for all of them or none.To be pedantic the examples work as intended and the problem only happens when changing the original data so this is expected. I mean if you are changing the example you should understand your change and what are the consequences that this entails (also update the value of the
Content-Typeheader in this particular case).it sometime hard for newcomers - change hello world to local language is common practice - so change base code to be newcomers friendly variant is not so bad idea (IMHO)
- added 2 commits that reference this issue
on Sep 22, 2020 - added a commit that references this issue
on Jul 27, 2026
in many cases changing "Hello, World!" to "Привет, мир!" lead to encoding hell
i guess it not good for newcomers :(
here http2 sample
==========================
==================
and how it look in browser -> Hello World (Привет, мир!)
:(