Skip to content

Commit 4cc07e3

Browse files
author
davidmatson
committed
Fix Unicode output on Windows.
Windows stdout supports Unicode just fine if it is told to do so.
1 parent 5089d31 commit 4cc07e3

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ Note, everything that is supported in Python is supported by C# API as well. C#
185185

186186
```csharp
187187
using System;
188+
using System.Text;
188189
using BlingFire;
189190

190191
namespace BlingUtilsTest
@@ -193,6 +194,8 @@ namespace BlingUtilsTest
193194
{
194195
static void Main(string[] args)
195196
{
197+
Console.OutputEncoding = Encoding.Unicode;
198+
196199
// load XLM Roberta tokenization model
197200
var h = BlingFireUtils.LoadModel("./xlm_roberta_base.bin");
198201

nuget/readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ Model handle: 94403233096000
4949
'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' '.' 'Я' 'уви-дел' 'де-ву-шку' 'с' 'те-лес-ко-пом' '. '
5050
Test Complete
5151
```
52-
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.
5352

5453
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):
5554
```

nuget/test/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text;
23
using BlingFire;
34

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

13+
Console.OutputEncoding = Encoding.Unicode;
1214

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

0 commit comments

Comments
 (0)