-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Don't convert buffer to string #7115
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7115 +/- ##
==========================================
- Coverage 41.46% 41.46% -0.01%
==========================================
Files 478 478
Lines 63966 63966
==========================================
- Hits 26526 26525 -1
- Misses 33984 33986 +2
+ Partials 3456 3455 -1
Continue to review full report at Codecov.
|
I'm not certain that this is enough. We're still going to be casting these bytes as a string to store them in the database which will cause the same problem. I think Patch needs to be a []byte not string. however, how do you display a []byte - well most often this is by casting to string or attempting to decode through detection. The trouble is detecting the encoding from such a small sample is going to be very difficult - you really need the rest of the file as context, and it's perfectly reasonable for a file to change encoding. As per usual file encoding is difficult and complex. The most complete answer probably involves:
|
We could detect the encoding of this file but not the patch and convert it to UTF8 before store it in database. |
Converting patch to utf-8 would be best option and would solve issue on storing into database |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
should fix #6236