Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

encoding guidelines to avoid issues with streams [closed]

What are the guidelines i should follow to avoid encoding issues when reading files or converting string to bytes, bytes to streams streams to reader etc. Any important notes, tutorials would also help.

Best Regards, Keshav

like image 876
keshav84 Avatar asked Jul 02 '26 04:07

keshav84


1 Answers

  • Avoid converting between bytes and strings needlessly
  • Be aware that werever you convert between bytes and strings, there is an encoding involved, implicitly or explicitly
  • Be very careful to avoid the API calls that use the platform default encoding (first and foremost: FileReader/Writer) unless you are handling user-supplied data without an explicitly declared encoding
  • If the file format / network protocol does have an explicit encoding declaration, make sure you use it correctly
like image 130
Michael Borgwardt Avatar answered Jul 03 '26 18:07

Michael Borgwardt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!