Skip to content
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

[BM2SM request] Forcibly save sm files using UTF-8 encoding format #7

Open
sillybear opened this issue Oct 19, 2018 · 3 comments
Open

Comments

@sillybear
Copy link
Contributor

No description provided.

@SaxxonPike
Copy link
Owner

@sillybear I like this suggestion. Stepmania supports reading these, yes?

@sillybear
Copy link
Contributor Author

sillybear commented Oct 23, 2018

Yeah any version. Default BM2SM encoding uses ANSI right? I have to manually resave files using utf-8 via notepad to make those non-Roman and special characters display correctly.

@SaxxonPike
Copy link
Owner

SaxxonPike commented Oct 25, 2018

According to StepmaniaSM.cs - the default encoding from the .NET StreamWriter is used. Which should already be UTF-8 according to this MSDN doc: https://docs.microsoft.com/en-us/dotnet/api/system.io.streamwriter?view=netframework-4.7.2

However! This does not write the byte order mark. Reading further in the MSDN documentation, we see this:
This behavior is different from the behavior provided by the encoding object in the Encoding.UTF8 property. To specify a BOM and determine whether an exception is thrown on invalid bytes, use a constructor that accepts an encoding object as a parameter, such as StreamWriter(String, Boolean, Encoding) or StreamWriter.

So, when we use StreamWriter, we should specify Encoding.UTF8 in the constructor. This looks like a simple 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

No branches or pull requests

2 participants