Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 03:40

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] GetEncoding (ANSI to Unicode)

Discussion on [C#] GetEncoding (ANSI to Unicode) within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2012
Posts: 51
Received Thanks: 32
[C#] GetEncoding (ANSI to Unicode)

I'm trying to write my own tools to help on translating HoMM online interface to english.
I'm writing my own classes to handle all this game related stuff. The problem comes when I need to handle chinese texts.
I need to read plain text from files in ANSI format, encoded with "GB18030" codepage (simplified chinese). I'm sure about the right codepage, as I can open these files with several programs (for example libre office calc) and get the correct chinese text if I select that codepage.

My code now is working on all implemented stuff, except I cannot read the right text if its chinese.

Code:
StreamReader sr = new StreamReader(filename, Encoding.GetEncoding("GB18030"), false);
text = sr.ReadToEnd();
Strings text and filename are already declared, and filename (from openFileDialog1.FileName) works well, but the text is not correct, I get garbage instead of chinese text (numbers or english words are shown well).

Any suggestion?

EDIT: Solved.
The code was reading well, but I was showing in a textBox; now in a richTextBox it shows properly.
urgabel is offline  
Reply


Similar Threads Similar Threads
[VB]Unicode
04/30/2011 - .NET Languages - 2 Replies
Cheers, Ich möchte eine Datei umbenennen, jedoch soll der neue Dateiname Unicoder Steuerzeichen enthalten und ich weiß nicht ganz wie ich das bewerkstelligen soll. Jemand eine Idee?
DDEML Ansi & Unicode ~ Client & Server
11/04/2007 - Archlord - 0 Replies
I know how to delete posts, but how do i delete a thread or is that only admin?
Unicode
04/14/2007 - Technical Support - 6 Replies
Hallo, hab mir vorhin ein paar neue Fonts installiert, und seither sehe ich die ü,ä und ö nurnoch als ? in einem schwarzen kasten. Ich sehe sie wenn ich hier tippe, aber wenn sie dann im Forum angezeigt bekomme sehe ich nurnoch die oben genannten ?. Muss ich irgendeinen besonderen Unicode installieren? Beim Font intallieren habe ich eigentlich nichts überschrieben, nur Fonts die ich nicht doppelt habe hinzugefügt. mfg edit: wer will kanns in technical support verschieben, seh ich eben...
unicode
06/06/2006 - Technical Support - 7 Replies
http://img286.imageshack.us/img286/3177/unicode6fk .jpg Das problem habe Ich, wenn Ich bestimmte 'texte' im "Editor" schreiben will. weiß jemand, wo ich das runterladen kann oder so, dass das weg geht?... hlep me plx^^ mfg Mahpets edit: " Listenfeld 'Codierung' " ist nicht da... :(:(



All times are GMT +1. The time now is 03:40.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.