GithubHelp home page GithubHelp logo

cosineg / opencc.net Goto Github PK

View Code? Open in Web Editor NEW
68.0 68.0 12.0 6.05 MB

The .NET version of OpenCC(Open Chinese Convert), for the conversion between Simplified Chinese and Traditional Chinese.

License: Apache License 2.0

C# 100.00%
c-sharp chinese csharp simplified-chinese traditional-chinese

opencc.net's People

Contributors

cosineg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

opencc.net's Issues

Can I use the repo in .NET 6.0?

Hello:
I want to test the repo to convert some tranditional Chinese text (Hong Kong) to simplified Chinese text.
I installed the latest version:
PM> Install-Package OpenCCNET -Version 0.2.2
But I found the repo is built with netstandard2.0.
I am coding with Visual Studio 2022 on Windows 10 for .NET 6.0.
I have the following C# code:
using OpenCCNET;
//using System.Text;
public static string HKToHant(string text)
{
ZhUtil.Initialize();
var textBuilder = new StringBuilder(text, text.Length * 2);
textBuilder.ConvertVariant(ZhDictionary.HKVariantsReversed);
return textBuilder.ToString();
}
But I got compiler error:
Error CS0246 The type or namespace name 'StringBuilder' could not be found

If I change the code, so it looks like:
using OpenCCNET;
using System.Text;
public static string HKToHant(string text)
{
ZhUtil.Initialize();
var textBuilder = new StringBuilder(text, text.Length * 2);
textBuilder.ConvertVariant(ZhDictionary.HKVariantsReversed);
return textBuilder.ToString();
}
Then I got another compiler error:
Error CS1061 'StringBuilder' does not contain a definition for 'ConvertVariant' and no accessible extension method 'ConvertVariant' accepting a first argument of type 'StringBuilder' could be found.
How can you fix this issue?
I suggest to upgrade to target .NET 6.0, since it is in long-term support, netstandard2.0. is too old.
Thanks,

Old code didn't work for new version of the repo.

Hello:
Today, I found the repo has a new release for NUGET, so I installed the new version (1.01), and try to test it, the follwing is the C# code:
ZhUtil.Initialize();
var document = new PdfDocument();
var page = document.AddPage();
var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("SimHei", 20, XFontStyle.Regular);
gfx.DrawString("你好現在正在測試".ToHansFromHK(), font, XBrushes.Black, new XRect(20, 20, page.Width, page.Height), XStringFormats.Center);
document.Save("test.pdf");
But the code didn't get compiled, I got error message:
Error CS0103 The name 'ZhUtil' does not exist in the current context.
I am using Visual Studio 2022, my project is WinForms targetting .NET 6.0.
Please advise on how to fix this issue.
Thanks,

Found one missing Chinese character.

Hello:
I used your repo., basically, it works well.
However, there is at least one tranditional chinese character missing in the library.
See the following picture, the first character is missing.
Its unicode seems to be: \u8F17
Please check.
Thanks,
UFOChinese

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.