You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use special characters in my code, like an accented u: ú, when the templates are rendered, and I open them in Visual Studio, the special characters doesn't look as expected. In this example ú appears where I should see the ú.
I've opened the file with Notepad++, and it detects is an UTF-8 file, and I see the special character as expected. If I try to see it as ANSI, I get the same result as in VS.
If I use Notepad++ to convert the file to ANSI, and see it in Visual Studio, it looks fine.
By default, Visual Studio detects a byte-order mark to determine if the source file is in an encoded Unicode format, for example, UTF-16 or UTF-8. If no byte-order mark is found, it assumes the source file is encoded using the current user code page, unless you have specified a code page by using /utf-8 or the /source-charset option.
It looks like the problem is in the SaveMethod of src/Typewriter/Generation/Template.cs, which invokes File.WriteAllText. According to the remarks in the documentation:
This method uses UTF-8 encoding without a Byte-Order Mark (BOM)
If you keep reading, you'll see this:
If it is necessary to include a UTF-8 identifier, such as a byte order mark, at the beginning of a file, use the WriteAllText(String, String, Encoding) method overload with UTF8 encoding.
If I use special characters in my code, like an accented u: ú, when the templates are rendered, and I open them in Visual Studio, the special characters doesn't look as expected. In this example ú appears where I should see the ú.
I've opened the file with Notepad++, and it detects is an UTF-8 file, and I see the special character as expected. If I try to see it as ANSI, I get the same result as in VS.
If I use Notepad++ to convert the file to ANSI, and see it in Visual Studio, it looks fine.
In this VS documentation page I can see:
It looks like the problem is in the
SaveMethod
ofsrc/Typewriter/Generation/Template.cs
, which invokesFile.WriteAllText
. According to the remarks in the documentation:If you keep reading, you'll see this:
Saving it as UTF8 is a good idea beacuse by default
tsc
expects the files to be encoded as UTF8(see --charset in https://www.typescriptlang.org/docs/handbook/compiler-options.html)The text was updated successfully, but these errors were encountered: