Skip to content

feat!: Do not parse response data as utf-8#51

Open
dany-fedorov wants to merge 1 commit intoaxiomzen:masterfrom
dany-fedorov:do-not-parse-data-as-utf-8
Open

feat!: Do not parse response data as utf-8#51
dany-fedorov wants to merge 1 commit intoaxiomzen:masterfrom
dany-fedorov:do-not-parse-data-as-utf-8

Conversation

@dany-fedorov
Copy link

Parsing binary data as utf-8 can cause problems, e.g. pdf file. Parsing as utf-8 replaces bytes that cannot be parsed with replacement character - https://en.wikipedia.org/wiki/Specials_(Unicode_block)#:~:text=The%20replacement%20character%20%EF%BF%BD%20(often,data%20to%20a%20correct%20symbol

For example bytes FB, FC, FD will each be replaced with replacement character which is 3 bytes long and the result will look like this - EF BF BD, EF BF BD, EF BF BD

BREAKING CHANGE: Changes the type of oldBody argument from string to Buffer

Parsing binary data as utf-8 can cause problems, e.g. pdf file.
Parsing as utf-8 replaces bytes that cannot be parsed with replacement
character - https://en.wikipedia.org/wiki/Specials_(Unicode_block)#:~:text=The%20replacement%20character%20%EF%BF%BD%20(often,data%20to%20a%20correct%20symbol

For example bytes FB, FC, FD will each be replaced with replacement
character which is 3 bytes long and the result will look like this -  EF BF BD, EF BF BD, EF BF BD

BREAKING CHANGE: Changes the type of oldBody argument from string to
Buffer
@dany-fedorov
Copy link
Author

Hey, this is going to need a major version bump if you're ok with this change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant