473,626 Members | 3,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RTF character set to codepage?

2 New Member
Hi,

I'm trying to convert some RTF text to Unicode UTF-16.

The characters I'm converting are double byte Japanese.
The character set is fcharset128 which should be codepage 932.
I am looking for a way to ask .NET given a character set for it to return the correct codepage or encoding.

How do I map the character set 128 to the correct codepage?


With other languages RTF gives the codepage, so its a simple matter of retrieving the encoding..e.g. normal codepage for english is 1252, so nSourceCodePage = 1252.

Expand|Select|Wrap|Line Numbers
  1.  Encoding srcEncoding = Encoding.GetEncoding(nSourceCodePage);
  2.                InBytes = new byte[2];
  3.                InBytes[0] = nFirstDoubleByte;
  4.                InBytes[1] = (byte)node.Parameter;
  5. //and convert to Unicode
  6.               Encoding unicodeEncoding = Encoding.GetEncoding(1200);
  7.               byte[] outputBytes = UnicodeEncoding.Convert(srcEncoding, unicodeEncoding, InBytes);
  8.              string unicodestring = System.Text.Encoding.Unicode.GetString(outputBytes);
Any help appreciated.
John
Mar 16 '08 #1
0 1449

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4954
by: Mark | last post by:
Hi... I've been doing a lot of work both creating and consuming web services, and I notice there seems to be a discontinuity between a number of the different cogs in the wheel centering around windows-1252 and that it is not equivalent to iso-8859-1. Looking in the registry under HKEY_CLASSES_ROOT\MIME\Database\Charset and \Codepage, it seems that all variations on iso-8859-1 (latin1, etc) are mapped to code page 1252, which I'm...
1
1974
by: CoolKiwiBloke | last post by:
When attempting to use characters above 0x8F in the QueryString (URL Escaped of course) these do not work when the CodePage is set to 1252 e.g. using test.aspx?test=%a3, ('£') the parameter 'test' shows up in trace.axd as being empty! A similar problem exists when entering characters into an input box (see code below) and then pressing submit e.g. '£' & '€' Removing the CodePage setting (which I guess uses UTF-8 by default) does...
2
2282
by: Ozer | last post by:
Hi friends, I wanna ask something. I use javascript menu on my user interface. And the js files contains special(turkish) character. I need to use codepage=1254 attribute in my @Page tag. If i don't use it. Javascript menu and functions fail. But if i add this atrribute, after i posted the form, all of the special(turkish) characters becomes deleted. Thanks for any help. Bye.
1
2449
by: Kenneth McDonald | last post by:
I am going to demonstrate my complete lack of understanding as to going back and forth between character encodings, so I hope someone out there can shed some light on this. I have always depended on the kindness of strangers... :-) I'm playing around with some very simplistic french to english translation. As some text to work with, I copied the following from a french news site:
18
8741
by: Marcel Saucier | last post by:
Hello, I want to use the above characters codes chart but I dont know how to set the typeface (documentation: The characters that appear in Windows above 127 depend on the selected typeface). For example, when I print the chr(205), I am not getting the one shown in the Chart 2 list... A step by step approach will be appreciated (in a windows form application). --
4
34148
by: George | last post by:
Hi, I am puzzled by the following and seeking some assistance to help me understand what happened. I have very limited encoding knowledge. Our SAP system writes out a text file which includes German characters. 1. When I use StreamReader(System.String filepath) without specifying an encoding method, the German characters such as Ä are lost when I do a ReadLine()
17
10645
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when talking with another team -- codepage -- at the same time. I am more confused when I saw sometimes we need codepage parameter for wide character conversion, and sometimes we do not need for conversion. Here are two examples,
13
3876
by: =?Utf-8?B?YXVsZGg=?= | last post by:
i have come across a situation in my project where i read a text file with some characters greater than hex 0x7f. i need to write character (0xE0) to a new file as an exception. however when i attempt to write this via "Console.Write" or "filestream.Write" it seems the value changes. most of the output file is in text mode. if i view the original file in binary mode i see the character i'm having issue with as "e0 00" but when i...
10
3970
by: Paul W | last post by:
Hi all, I have an application that reads data in from a text file and stores it in a database. My problem is that there are some characters in the file that aren't being handled properly. For instance, one of the characters has an ASCII code of 150 (it looks like a dash '-'), when I'm debugging this character is displayed as the square box that Windows uses for unsupported characters and when it's copied to the database it's stored as...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.