paulirwin commented on issue #1027:
URL: https://github.com/apache/lucenenet/issues/1027#issuecomment-2561483864

   I have reviewed usages of Encoding (most commonly `Encoding.UTF8`), and 
determined that most usages do not need to be changed. The following cases do 
not result in a BOM being generated:
   
   - `Encoding.UTF8.GetBytes(string)`
   - `J2N.Text.StringExtensions.GetBytes(this string, Encoding)`
   - Use of `Encoding.Default` or `Encoding.GetEncoding(0)` which [uses a 
BOM-less UTF8 encoding on modern .NET, or the system current code page on .NET 
Framework](https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-text-encoding-default)
   
   The following cases ignore a BOM if present, and do not fail if there is not 
a BOM, and thus do not need to be changed to a BOM-less Encoding:
   - Any TextReader use (such as StreamReader)
   - `IOUtils.GetDecodingReader(...)`
   - `Encoding.UTF8.GetString(byte[])`
   - FileStream with `FileAccess.Read`
   
   So you'll see in the PR that the amount of changes to address BOM issues are 
not very many; that's because most fall into those buckets above.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to