Skip to content

benrobot/EncodingTests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EncodingTests

dotnet-ubuntu.yml dotnet-windows.yml

BEWARE the file encoding

This project was created in preparation for asking a question on Stackoverflow (https://stackoverflow.com/q/67950751/3166133)

Problem

On a private project I had a unit test that passed on Windows and failed on Linux. I narrowed it down to an issue with encoding U+2019 RIGHT SINGLE QUOTATION MARK.

On Windows, calling System.Text.Encoding.UTF8.GetBytes("’") resulted in the correct 3 bytes (0xE2, 0x80, 0x99) but on Linux (tested on Ubuntu) the result bytes correspond to � (0xEF, 0xBF, 0xBD).

Cause

The .cs file where my code had the was ANSI (Windows-1252) encoded.

Fix

Convert my ANSI (Windows-1252) encoded files to

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages