Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fd#write(: Buffer) does not write #98

Open
vihanb opened this issue Dec 25, 2016 · 10 comments
Open

fd#write(: Buffer) does not write #98

vihanb opened this issue Dec 25, 2016 · 10 comments
Assignees
Labels

Comments

@vihanb
Copy link
Member

vihanb commented Dec 25, 2016

Version: v1.0.5

fd#write function when passed a Buffer, does not write any text to the file. However when passed a String object, it correctly writes to the file

@vihanb vihanb self-assigned this Dec 25, 2016
@vihanb vihanb added the bug label Dec 25, 2016
@schas002
Copy link

Just convert the Buffer to a string. All 😝

@vihanb
Copy link
Member Author

vihanb commented Dec 26, 2016

@schas002 however the lovely UTF16 will mangle your bytes.

@schas002
Copy link

Make something that enforces a 256-character encoding on strings. (Like, a Latin1String.) Then convert the Buffer to a string with that rule enforced and you're done. 😝

@RikerW
Copy link

RikerW commented Dec 26, 2016

The problem is that enforces a 256 character encoding. What if you want unicode?

@schas002
Copy link

I suggested a new type.

@schas002
Copy link

in "(Like, a Latin1String.)"

@vihanb
Copy link
Member Author

vihanb commented Dec 26, 2016

That would be slow and it would be a buffer internally anyway.

@vihanb
Copy link
Member Author

vihanb commented Dec 26, 2016

Strings are kinda like:

        Input          Internal       Output
  Source Encoding ->   UTF-16 -> Target Encoding

Meaning internally they are stored as UTF-16

@vihanb
Copy link
Member Author

vihanb commented Dec 26, 2016

However Output is a buffer anyway

@schas002
Copy link

So we may go only the hard path: using rubber ducks to resolve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants