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

Fix Unicode output on Windows. #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Note, everything that is supported in Python is supported by C# API as well. C#

```csharp
using System;
using System.Text;
using BlingFire;

namespace BlingUtilsTest
Expand All @@ -193,6 +194,8 @@ namespace BlingUtilsTest
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;

// load XLM Roberta tokenization model
var h = BlingFireUtils.LoadModel("./xlm_roberta_base.bin");

Expand Down
1 change: 0 additions & 1 deletion nuget/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Model handle: 94403233096000
'Au-topho-bia' ',' 'al-so' 'called' 'mono-pho-bia' ',' 'iso-lopho-bia' ',' 'or' 'e-re-mopho-bia' ',' 'is' 'the' 'spe-ci-fic' 'pho-bia' 'of' 'iso-la-tion' '.' 'I' 'saw' 'a' 'girl' 'with' 'a' 'te-le-s-cope' '.' 'Я' 'уви-дел' 'де-ву-шку' 'с' 'те-лес-ко-пом' '. '
Test Complete
```
Note: In Windows console default encoding is set to something old so only ascii symbols will be printed, but this is a display issue. You can manually set it to use UTF-8 if you want proper output.

After changes were made to the nuget package, to create a new NuGet package run from the lib folder (here use Release configuration since we are going to publish it):
```
Expand Down
2 changes: 2 additions & 0 deletions nuget/test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Text;
using BlingFire;

namespace BlingUtilsTest
Expand All @@ -9,6 +10,7 @@ static void Main(string[] args)
{
Console.WriteLine("Start C# test...");

Console.OutputEncoding = Encoding.UTF8;

// see the version of the DLL
Console.WriteLine(String.Format("Bling Fire version: {0}", BlingFireUtils.GetBlingFireTokVersion()));
Expand Down