Skip to content

Commit

Permalink
Fix Unicode output on Windows.
Browse files Browse the repository at this point in the history
Windows stdout supports Unicode just fine if it is told to do so.
  • Loading branch information
davidmatson committed Jul 19, 2023
1 parent 5089d31 commit 8a7e48c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
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

0 comments on commit 8a7e48c

Please sign in to comment.