Click here to Skip to main content
15,848,904 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I would like to print a Rupee symbol, Unicode U+20B9.
In my notepad I use courier new font.
The Rupee symbol will work when we use Rupee font.

I planned to convert Unicode and then take print out using dos and run .bat file.

Guide me.
Updated 19-Nov-11 11:39am
Mehdi Gholam 19-Nov-11 2:06am    
Just save your text in unicode, notepad understands unicode.

You still need the Rupee font, see:[^],[^].

As this character point was officially presented on 15 July 2009 and only recently standardized by Unicode, it wasn't integrated into any operating system yet (see the link above).

As to DOS and ASCII — just forget it. This part of question makes no sense and probably based on some misunderstanding of what Unicode is. De-confusing reading is here:[^],[^],[^].


In reply to "but":

you should understand that the whole notion of "conversion" from Unicode to ASCII and ASCII to Unicode makes no sense because Unicode… is not encoding, in contrast to ASCII. (However, it depends on what do you call "Unicode", because in Windows jargon, the term "Unicode" is often used for one of the Unicode Transformation Formats (UTFs), UTF16LE.) Unicode is a standard which defines formal one-to-one correspondence between "characters" understood as some cultural categories abstracted from their exact graphics (for example, Latin "A" and Cyrillic "А" are different characters, you can test it by using text search on this paragraph) and integer numbers, abstracted from their computer presentation like size and endianess. Despite of common wrong opinion, this is not 16-bit code as the range of "code points" presently standardized by Unicode goes far beyond the range which can fit in 16 bits (called Base Multilingual Plane, BMP). As there are different integer types, there are several different ways to represent Unicode text called UTFs.

Windows internally represents Unicode using UTF16LE (and yes, UTF16, as well as UTF8 and UTF32 can represent code points beyond first 16 bits of BMP), but all the APIs are well abstracted from this fact. The UTFs appears when character data is serialized (not "converted") into array of bytes. Character data can also be serialized into ASCII, but some information may or may not be lost, because the range of ASCII is only 0 to 127, and the character points have the same "meaning" as in Unicode. Traditionally, the lost characters (those beyond ASCII range) are "converted" to '?'. ASCII data as a array of bytes can be deserialized into character data (.NET string) and, naturally, that always goes without losses. In other word, ASCII code has one-to-one correspondence with the subset of Unicode with code points 0 to 127.

That said, again: there is no such concept as "conversion" between ASCII and Unicode.

Share this answer
kalaiking 19-Nov-11 2:16am    
thatraja 19-Nov-11 2:32am    
Sergey Alexandrovich Kryukov 19-Nov-11 16:30pm    
There can be a lot of confusion. It's amazing how many developers totally misunderstand Unicode despite using it with .NET and other platforms. The question clearly shows that OP needs some explanation. I tried to clarify a bit.
Sergey Alexandrovich Kryukov 19-Nov-11 16:30pm    
But..? Please see my update after [EDIT].
using System;
using System.Text;

namespace ConvertExample
   class ConvertExampleClass
      static void Main()
         string unicodeString = "This string contains the unicode character Pi(\u03a0)";

         // Create two different encodings.
         Encoding ascii = Encoding.ASCII;
         Encoding unicode = Encoding.Unicode;

         // Convert the string into a byte[].
         byte[] unicodeBytes = unicode.GetBytes(unicodeString);

         // Perform the conversion from one encoding to the other.
         byte[] asciiBytes = Encoding.Convert(unicode, ascii, unicodeBytes);
         // Convert the new byte[] into a char[] and then into a string.
         // This is a slightly different approach to converting to illustrate
         // the use of GetCharCount/GetChars.
         char[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
         ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
         string asciiString = new string(asciiChars);

         // Display the strings created before and after the conversion.
         Console.WriteLine("Original string: {0}", unicodeString);
         Console.WriteLine("Ascii converted string: {0}", asciiString);
Share this answer
kalaiking 19-Nov-11 2:47am    
Pi -> (\u03a0)
Rupee Symbol -> ?
kalaiking 19-Nov-11 2:55am    
string unicodeString = "This function contains a unicode character pi (\u03a0)";

string unicodeString1 = "This function contains a unicode character rs (\u0971)";

but in output i get
This function contains a unicode character rs (?)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900