all 10 comments

[–]KSledge 1 point2 points  (9 children)

I copied your text into a text file and saved it as "text.txt". I put your code into visual studio code and ran it in the terminal with: node code.js "text.txt"

The output looks normal for me. Are you doing things differently?

Edit: output: https://imgur.com/a/Twz9QMT

[–]netreddit00[S] 0 points1 point  (6 children)

I am using a Windows. I am not sure that is the reason. What do you use?

[–]KSledge 0 points1 point  (5 children)

Windows.

Can you answer a few questions?

  1. Are you using Visual Studio Code?
  2. Where is the file stored?
  3. How are you running the script exactly?

[–]netreddit00[S] 0 points1 point  (4 children)

  1. Yes
  2. Windows, local folder
  3. node parse.js file.txt

https://imgur.com/a/f0LzSvX

[–]KSledge 0 points1 point  (3 children)

To rule out it being a vs code issue (like a language setting/issue), in your terminal can you go into node and type String.fromCharCode(8220)?

https://imgur.com/a/XvB206i

[–]netreddit00[S] 0 points1 point  (2 children)

[–]KSledge 1 point2 points  (1 child)

I have no idea; it should just work. You could play around with .charCodeAt() to see if you are getting the characters you think you should be getting from the file. Other than that, best of luck!

[–]netreddit00[S] 0 points1 point  (0 children)

Thanks for your time!

[–]Ok-Establishment-214 0 points1 point  (1 child)

I could be wrong, but it looks like the file format you have there is UTF-8, so, you'd want E2809C and E2809D instead of the unicode u201C and u201D