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 — repl: surrogate pair upsets repl / terminal · Issue #690 · nodejs/node

repl: surrogate pair upsets repl / terminal #690

New issue
Copy link
New issue
Copy link
Closed
Closed
repl: surrogate pair upsets repl / terminal#690
Copy link
Labels
confirmed-bugIssues and PRs for confirmed bugs.replIssues and PRs related to the REPL subsystem.stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.

Description

@bnoordhuis
bnoordhuis
opened on Feb 2, 2015
Issue body actions
$ out/Release/iojs
> Buffer([0,0xD8,0,0xDC]).toString('utf16le')
'
# screen freezes

The REPL still accepts input but no longer echoes it. Typing in process.exit() cleanly shuts down the process but the terminal isn't reset, leaving it in an unusable state until you run reset(1).

Activity

  1. bnoordhuis
    added
    replIssues and PRs related to the REPL subsystem.
    on Feb 2, 2015
  2. jasnell commented on Feb 2, 2015

    @jasnell
    jasnell
    on Feb 2, 2015
    Member
    More actions

    Unable to replicate the behavior in io.js 1.0.4 on macosx 10.10.

  3. bnoordhuis commented on Feb 2, 2015

    @bnoordhuis
    bnoordhuis
    on Feb 2, 2015
    MemberAuthor
    More actions

    Sorry, I should have mentioned that this is with v1.x HEAD and that I can reproduce it with the stock FC21 terminal emulator and with the OS X 10.8 terminal emulator when ssh'ing into an FC21 box but not when run locally - and only when TERM=screen, TERM=xterm works.

  4. jasnell commented on Feb 2, 2015

    @jasnell
    jasnell
    on Feb 2, 2015
    Member
    More actions

    Ah... Just for completeness... did you double check the locale on the FC21 box?

  5. bnoordhuis commented on Feb 2, 2015

    @bnoordhuis
    bnoordhuis
    on Feb 2, 2015
    MemberAuthor
    More actions

    It's en_US.UTF-8. Starting screen with e.g. LC_ALL=C doesn't make a difference. I'm not sure if screen is locale-aware, though.

  6. Fishrock123 commented on Apr 4, 2015

    @Fishrock123
    Fishrock123
    on Apr 4, 2015
    Contributor
    More actions

    Seems to work fine on mine...?

    screen shot 2015-04-04 at 6 30 55 pm

    (I can't seem to copy that character to my clipboard though..)

  7. Fishrock123 commented on Apr 4, 2015

    @Fishrock123
    Fishrock123
    on Apr 4, 2015
    Contributor
    More actions

    but not when run locally - and only when TERM=screen

    Oh, missed that.

  8. brendanashworth
    added
    confirmed-bugIssues and PRs for confirmed bugs.
    confirmed-bug
    and removed
    confirmed-bug
    on Apr 20, 2015
  9. jsonn
    added a commit that references this issue on Sep 9, 2015

    Update to 4.0.0

    33b3766
  10. jdalton commented on Dec 10, 2015

    @jdalton
    jdalton
    on Dec 10, 2015
    Member
    More actions

    @mathiasbynens have you seen this?

  11. d3x0r commented on Jan 30, 2016

    @d3x0r
    d3x0r
    on Jan 30, 2016
    Contributor
    More actions

    While part of this is definatly in the V8 engine, I think probably the output is an issue from Node.
    (Windows platform)

    // heiroglyph.js
    // actual character is 0x13063
    // from http://unicode.org/charts/PDF/U13000.pdf
    var character = "\ud80c\ud863"
    
    var json = JSON.stringify( { msg : character });
    console.log( json );
    console.log( character );
    
    console.log( "\ud80c\ud863".codePointAt(0).toString(16) );
    console.log( "\ud80c\ud863".codePointAt(1).toString(16) );
    console.log( "\u13302".charCodeAt(0).toString(16) );
    

    node heiroglyph.js > output.txt

    the unicode characters '\ud80c' is converted to utf8 '\xef\xf\bd'
    and '\ud863' is converted to '\xef\xbf\xbd' which is entirely wrong...

    output (loaded in console ascii editor)

    {"msg":"��"}
    ��
    d80c
    d863
    1306
    

    or this... loaded in notepad++ with unicode which looks closer to correct...

    {"msg":"��"}
    ��
    d80c
    d863
    1306
    

    expected output would be

    {"msg":"𓁓"}
    𓁓
    d80c
    d863
    1306
    

    or in utf8 bytes '\xf8\x9d\x81\x93'

    (expected, given that charCodeAt doesn't function 'correctly' but that's not Node's fault)

  12. bnoordhuis commented on Jan 30, 2016

    @bnoordhuis
    bnoordhuis
    on Jan 30, 2016
    MemberAuthor
    More actions

    @d3x0r I don't think that's the bug - or a bug. \ud80c\ud863 is not a valid surrogate pair, the second half should be >= \udc00 (e.g. \ud80c\udc63 would be valid.)

    \ud80c\ud863 is basically two invalid code points. Those get replaced with the replacement character, \ufffd, which is 0xEF 0xBF 0xBD when encoded as UTF-8.

  13. d3x0r commented on Jan 30, 2016

    @d3x0r
    d3x0r
    on Jan 30, 2016
    Contributor
    More actions

    Yes; I was reflecting on it and realized that. (and while re-reading found that the second byte is supposed to be DC.

    var character = "\ud80c\udc63"
    
    var json = JSON.stringify( { msg : character });
    console.log( json );
    console.log( character );
    console.log( character.codePointAt(0).toString(16) );
    

    output is now

    {"msg":"ЁУБг"}
    ЁУБг
    13063
    

    ( F0 93 81 a3 ) which is right.... even if things aren't reading it correctly now :)

  14. MylesBorins commented on Feb 11, 2016

    @MylesBorins
    MylesBorins
    on Feb 11, 2016
    Contributor
    More actions

    I just attempted this in a screen session and everything worked. @bnoordhuis can you confirm you are still seeing this?

  15. bnoordhuis commented on Feb 12, 2016

    @bnoordhuis
    bnoordhuis
    on Feb 12, 2016
    MemberAuthor
    More actions

    Yes, still happens. I don't mind closing this, though. I have looked at this issue a few times and I'm not sure if there is anything reasonable node.js can do here; it's quite possibly just an unfortunate interaction between ssh, screen and node.

  16. jasnell
    added
    stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.
    on Mar 9, 2016
  17. jasnell commented on Apr 2, 2016

    @jasnell
    jasnell
    on Apr 2, 2016
    Member
    More actions

    @bnoordhuis ... is it possible to put together a known-issue test for this?

  18. Fishrock123 commented on Jul 19, 2016

    @Fishrock123
    Fishrock123
    on Jul 19, 2016
    Contributor
    More actions

    Not sure that's possible... Let's just close this.

  19. Fishrock123
    closed this as completedon Jul 19, 2016
  20. msk
    added a commit that references this issue on May 11, 2026

    Update to 4.0.0

    e40913a
  21. tsutsui
    added a commit that references this issue on Oct 17, 2026

    Update to 4.0.0

    bdd3ecb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.replIssues and PRs related to the REPL subsystem.stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — 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.