GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: fix misleading ASCII comments by rahatarmanahmed · Pull Request #11657 · nodejs/node

Conversation

@rahatarmanahmed

@rahatarmanahmed rahatarmanahmed commented Mar 2, 2017

Copy link
Copy Markdown
Contributor

Fixed a couple of misleading references to ASCII for default encoding examples (should be UTF-8).

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to Node.js documentation. labels Mar 2, 2017
addaleax
addaleax reviewed Mar 2, 2017
View reviewed changes
Comment thread doc/api/buffer.md Outdated

@addaleax addaleax Mar 2, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not ASCII bytes, though?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rahatarmanahmed rahatarmanahmed Mar 2, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand, did I make an error in the result?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@addaleax addaleax Mar 2, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASCII encoding uses only the bytes up to 127, and it can’t encode characters such as é at all. In some places of the API – like Buffer.from(…, 'ascii') – Node just treats ascii like latin-1 for performance reasons, where é maps to 0xe9. That doesn’t always work, though; for example:

> Buffer.from('tést', 'ascii').toString('ascii')
'tist'

If you want to use this example, I’d suggest going with something like Latin-1 bytes, and use Buffer.from(…, 'latin-1').

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rahatarmanahmed rahatarmanahmed Mar 2, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, wasn't aware of that. I'll change it to latin-1.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
addaleax
addaleax reviewed Mar 2, 2017
View reviewed changes
Comment thread doc/api/buffer.md Outdated

@addaleax addaleax Mar 2, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this example? I think I can see where this is coming from, but it might be better to just replace ASCII with ASCII/UTF-8 in the comment?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rahatarmanahmed rahatarmanahmed Mar 2, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning was that it's more consistent with the other examples in the doc, and also shows the difference between the two encodings that will affect the output ('test' is the same in ascii and utf8 but not 'tést'). That may or may not be important

Just changing the text to ASCII/UTF-8 is still an improvement but I think this example is clearer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@rahatarmanahmed
doc: fix misleading ASCII comments
7786102
@rahatarmanahmed
rahatarmanahmed force-pushed the patch-1 branch from 602eb99 to 7786102 Compare March 2, 2017 15:51
addaleax
addaleax approved these changes Mar 2, 2017
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
claudiorodriguez
claudiorodriguez approved these changes Mar 2, 2017
View reviewed changes
jasnell
jasnell approved these changes Mar 2, 2017
View reviewed changes
cjihrig
cjihrig approved these changes Mar 3, 2017
View reviewed changes
@addaleax

addaleax commented Mar 5, 2017

Copy link
Copy Markdown
Member

Landed in bbc118f, thanks for the PR! 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax addaleax closed this Mar 5, 2017
addaleax pushed a commit that referenced this pull request Mar 5, 2017
@rahatarmanahmed @addaleax
doc: fix misleading ASCII comments
bbc118f
PR-URL: #11657
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Claudio Rodriguez <[email protected]>
addaleax pushed a commit that referenced this pull request Mar 5, 2017
@rahatarmanahmed @addaleax
doc: fix misleading ASCII comments
d06dbf0
PR-URL: #11657
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Claudio Rodriguez <[email protected]>
@evanlucas evanlucas mentioned this pull request Mar 8, 2017
v7.7.2 proposal #11745
Merged
@MylesBorins MylesBorins added the land-on-v6.x label Apr 17, 2017
MylesBorins pushed a commit that referenced this pull request Apr 17, 2017
@rahatarmanahmed @MylesBorins
doc: fix misleading ASCII comments
91d694e
PR-URL: #11657
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Claudio Rodriguez <[email protected]>
@MylesBorins

MylesBorins commented Apr 17, 2017

Copy link
Copy Markdown
Contributor

backported to v6.x... lmk if I was mistaken to do so

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MylesBorins pushed a commit that referenced this pull request Apr 19, 2017
@rahatarmanahmed @MylesBorins
doc: fix misleading ASCII comments
e02d724
PR-URL: #11657
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Claudio Rodriguez <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Apr 19, 2017
v6.10.3 proposal #12498
Merged
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
@rahatarmanahmed @andrew749
doc: fix misleading ASCII comments
1f285e6
PR-URL: nodejs/node#11657
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Claudio Rodriguez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@addaleax addaleax addaleax approved these changes
@cjihrig cjihrig cjihrig approved these changes
+1 more reviewer
@claudiorodriguez claudiorodriguez claudiorodriguez approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to Node.js documentation.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@rahatarmanahmed @addaleax @MylesBorins @jasnell @cjihrig @claudiorodriguez @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.