When the code is chines/ japan or some other I get square boxes

Hi!

When I run this code below I get square boxes for some code point what does 
this mean. ?
I get square boxes for chinese/japanese and some other.
I would say that when the code page exist why is not windows able to display 
the character for this code point.
Is it because of the driver to the screen does not support these characters. 
I'm just curious ?

byte[] b = new Byte[256];
         for (int i = 0; i < b.Length; i++)
            b[i] = (byte)i;

         EncodingInfo[] ei = Encoding.GetEncodings();
         foreach(EncodingInfo e in ei)
         {
            string s = Encoding.GetEncoding(e.CodePage).GetString(b, 32, 
224);
            MessageBox.Show(e.DisplayName);
            MessageBox.Show(s);
         }

//Tony 


0
Tony
6/4/2010 10:38:01 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

3 Replies
771 Views

Similar Articles

[PageSpeed] 54

Tony Johansson wrote:
> Hi!
>
> When I run this code below I get square boxes for some code point what does
> this mean. ?
> I get square boxes for chinese/japanese and some other.
> I would say that when the code page exist why is not windows able to display
> the character for this code point.
> Is it because of the driver to the screen does not support these characters.
> I'm just curious ?
>
> byte[] b = new Byte[256];
>           for (int i = 0; i<  b.Length; i++)
>              b[i] = (byte)i;
>
>           EncodingInfo[] ei = Encoding.GetEncodings();
>           foreach(EncodingInfo e in ei)
>           {
>              string s = Encoding.GetEncoding(e.CodePage).GetString(b, 32,
> 224);
>              MessageBox.Show(e.DisplayName);
>              MessageBox.Show(s);
>           }
>
> //Tony
>
>

It must be a problem on your computer.

Does Chinese and Japanese text render fine otherwise?
あいうえお
These five (Japanese) characters for instance, should look like the ones 
at the top row here:
http://www.silba.co.kr/jmbh/2047_01.gif
They should by default render correctly in Windows Vista and 7, but not 
in XP unless you have installed support for East Asian languages.

Tried the code on my computer (with Windows 7) and text renders fine 
with that code:
http://i47.tinypic.com/2pu018i.jpg

May be a font issue as well, but I doubt it. I think it might use a 
different font to render that text (if available).

-- 
Regards,
Jackie
0
Jackie
6/4/2010 11:27:49 PM
Tony Johansson wrote:
> Hi!
> 
> When I run this code below I get square boxes for some code point what does 
> this mean. ?
> I get square boxes for chinese/japanese and some other.
> I would say that when the code page exist why is not windows able to display 
> the character for this code point.
> Is it because of the driver to the screen does not support these characters. 
> I'm just curious ?

In addition to Jackie's answer, keep in mind that you need to be 
displaying the text using a font that has glyphs for those characters. 
I would guess that the default font for the MessageBox class doesn't, 
unless your system is configured with the International settings set for 
Japanese (for example).

Pete
0
Peter
6/5/2010 3:39:34 AM
> When I run this code below I get square boxes for some code point what does 
> this mean. ?
> I get square boxes for chinese/japanese and some other.
> I would say that when the code page exist why is not windows able
> to display the character for this code point.
> Is it because of the driver to the screen does not support these
> characters. 
> I'm just curious ?

First you have to make sure the characters are really Chinese/Japanese.
Converting a bunch of bytes with all the code pages is unlikely to
produce valid characters.

If that is ok, then the problem is the font.
Do you have Chinese/Japanese support installed?

On XP make sure you check the "Install files for East Asian languages"
in "Regional and Language Options" - "Languages" tab:
  http://linguistic.artofcode.nl/wp-content/regional_and_language_options.png

On Vista/Win 7 all the support is there by default.


-- 
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

0
Mihai
6/5/2010 7:30:08 AM
Reply:

Similar Artilces:

Integrate Paycodes, benefit codes and deduction codes
Has anyone used integration manager to update new pay rates, deduction amounts and benefit amounts for employees? At the beginning of each year, our company gives pay increases and we need to update the pay codes, deduction codes and benefit codes for 40 employees, which we get the information from a spreadsheet. I thought that maybe I could use integration manager to update the pay, benefit and deduction codes instead of going into each employee's card, which is time consuming. Thanks, Laura Integration Manager will allow you to do this. Use the Payroll Master Destination. one ...

Can't delete Money investment; investment gets recreated after every download
Hi, I'm running into an annoying issue with Money 2006: A while ago I accidentally set up two investments for MSFT: one with an associated stock symbol, and the other obviously with no symbol. I would like to merge these two investments. I tried doing that by remapping all of the 'wrong' investment transactions to the right investment (the one with the stock symbol), and then deleting the wrong investment. However, every time I go to download account updates from Fidelity, I get a prompt saying "you've got xxx stock of Microsoft Corp. (the wrong type)". If I le...

Get "Server is unavailable" message
I get the following error message when i try to setup outlook with an exchange server account; "Microsoft Exchange Server is unavailable." I have a Small Business Server 2003 setup on our local network with around 17 or more client computers. The Computers are either windows 2000 or XP running outlook 2000 / 2003. All computers have successfully connected to the exchange server except one. The problem computer is runnning windows 2000 professional edtion with outlook 2003 installed I have tested the following: - 1) uninstalling / reinstalling outlook 2) disabling & rem...

zip codes don't merge #2
I am trying to mail merge w/ Word 2000 the names and addresses in my worksheet. When I get to the part to choose the format for the mailing labels, I choose F1, F2, etc. to F6 (which is the zip code column). A few do get there, but the vast majority stop at the state, leaving off the entire zip code. I have gone to menu/format and selected text in the number tab. I have gone to format/cells and chosen special/zip code in the number tab. I've read Excel for Dummies. Please help me. TIA bb ...

Getting output from CreateProcess into my application...
I am using CreateProcess from within a dialog based MFC application to spawn a console program. I want to use that programs standard output to provide input to my application. I have set up the application data and create process call like so: memset(&process_info, 0, sizeof(addp_process_info)); memset(&startup_info, 0, sizeof(addp_startup_info)); /* Initialization of structures */ startup_info.cb = sizeof(startup_info); startup_info.dwFlags = STARTF_USESTDHANDLES; /* Experimental */ /* Setup a handle... */ m_hOutput = CreateFile("output.tmp", GENERIC_READ | GE...

concatenating two vendor codes
My company recently changed the vendor codes and now I end up with two separate sets of data for each vendor. Obviously I could just leave the vendor code field out. I don't want to do that so what I need to do is concatenate the two codes. Example Vendor Code Vendor Name 123 Joe's Supplies ABC Joe's Supplies what I need is this Vendor Code Vendor Name 123/ABC Joe's Supplies any ideas? Rather than create a new record for each vendor, add another field to the table -- call it NewVendorCode -- and put th...

Any way to get around the 240-character line limit on text output?
I'm trying to save an Excel file into a fixed-length file for import into a mainframe and the biggest problem (as pointed out in another post on this board) is that there is a limit of 240 characters per line. This causes the rest of each line to be placed at the end of the file. My record layout length is around 300 and we're talking about 50,000 records. How can I get around the 240 character limit to save this file in an acceptable format? Otherwise it will take hours of work to get the file in the proper format. http://support.microsoft.com/default.aspx?scid=kb;en-us;13155...

Combo boxes and AutoSum
What function would I use to add a range of numbers that includes a combo box? I tried AutoSum but the Total doesn't recalculate when I change the number in the combo box. Thanks so much! Do you have the combo box linked to a cell? A combo box does not occupy a cell, it "floats" on top of the worksheet. If you have the combo box linked to a cell the linked cell will return the *index number* of the selected item. Depending on what numbers you have as selections for the combo box, you then have to associate the selection index number with the actual value of the...

Can MS EXCEL remove duplicates and separate by color coded items ?
Can MS EXCEL remove duplicates and separate by color coded items ? I am NOT technical and have just started using MS EXCEL. Can anyone PLEASE HELP me: 1. How can I automatically remove duplicates using EXCEL ? ie the same info input more than once on different lines. Can EXCEL do this ? 2, I have color coded the text in the certain lines in terms of priority. can Excel rearrange the data by color ? If yes, How do I do it ? I think I have EXCEL '97 Thanks for your help in advance. Hi 1. You can extract the unique items to a new list using menu Data > Filter > Advanced fil...

when i start outlook, i get a "migrating user info...." or someth.
when i start outlook, i get a "migrating user info...." or something like that, then it tells me that "the of folders couldn't be opened" and then it shuts down. i can't even open it to tweak the preferences and fix the problem.....what is my problem anyway ? JD <JD@discussions.microsoft.com> wrote: > when i start outlook, i get a "migrating user info...." or something > like that, then it tells me that "the of folders couldn't be opened" > and then it shuts down. i can't even open it to tweak the > preferences an...

16 bit code
Hello, I have a 16 bit code to maintain. (It is too complex to copile it to 32 bit) so all we are doing is support. Now they want to add a small feature, where I need to copy long file names in the project. I know we can not do long file name copies in vc++ (1.52). So I wrote a program in VC++(6.0) which does directory copy. My questions are 1. How can I call a 32 bit exe (I guess WinExec should work)? 2. How can I make the 16 bit to wait till the 32 bit code completes? 3. Is there any other better way to do this? (other than converting to 32 bit) Thanks. I actually do this in an old 16-bi...

area codes is auto filling my own 9 digit ph# vs just area code
When I enter a phone number for a contact it autofills with my personal area code and phone number instead of just the area code. How to I change this to just autofil the area code? I am using Outlook 2007 on an ACER laptop. Make sure you have your area code entered correctly in "Dialing Properties". "Computer Dummy" wrote: > When I enter a phone number for a contact it autofills with my personal area > code and phone number instead of just the area code. How to I change this to > just autofil the area code? I am using Outlook 2007 on an ACER ...

Return Reply for sub-email box
I have the following setup for the employees at my work: Every user has their own user in box Some users share a community in box that has it's own user name that those particular employees are authorized to send e-mails on behalf of. Currently, when one of the employees reply to the community in box, the reply comes from the community user name on behalf of the main user. If a customer of ours replies, the e-mail returns to the community mail box. I'd like the default when an e-mail is replied to from this community box that the main users e-mail is the default reply for our cust...

VBA Code for Pasting Sheets
I would like a spreadhseet that pastes the contents of one sheet into another sheet. I like like to do this for 7 different sheets For example: I would like paste the contents form sheet titled "sheet1" into a sheet titled "data1". Continue to process for pasting "sheet2" into "data2" and "sheet3" into "data3" all way until "sheet7" and "data7". thanks, Curt Subject: Automated Copy Paste Subject: Copy/Paste Import/Export Data VBA Code On Apr 27, 10:49=A0am, Curt <C...@discussions.mi...

Get the list of external links
Is there any way to get the list of external links referred by a workbook? Normally, we get this list by using Edit->Links in Microsoft excel. But I want to know the list of external links by programmatically. Thanks in advance. Cheers, Venkat Take a look at VBA's help for LinkSources. There is sample code there. Venkat wrote: > > Is there any way to get the list of external links referred by a workbook? > Normally, we get this list by using Edit->Links in Microsoft excel. But I > want to know the list of external links by programmatically. > > Than...

MC/VISA joint code
Isn't there any way to combine the blocks (4* & 5*) for MC/VISA credit cards? It's a pain to have them separate because my bank posts them together. It is the same company afterall. It would save me a lot of time adding separate entries together to reconcile the statement! I do not know of a way to do what you are asking, but I have found that using the # symbol as follows works better than using the * symbol: 4############### 5############### If you use the * symbol it is a wild card with no determined length. The # symbol requires that the characters after the first d...

Money 2004 - Experian Offer
I just loaded Money 2004 Deluxe and converted my 2003 files with no problem. I decided to give the free year of credit monitoring from Experian a try but after filling everything out I get an error that the provided code has expired. I neither had nor provided any code for this offer, I only used the link from Money 2004. Now Experian was more than willing to set up a $79 account if I wanted to proceed. Any solution out there? I have the same problem... I am looking for a FREE way to contact Microsoft about this problem. >-----Original Message----- >I just loaded Money 2004 ...

Message Boxes
Hi there I am having a play around with message boxes and need a little help. I know how to show a message box that displays YES NO CANCEL. what I don't know how to do is get the YES NO working. I would like YES to save the workbook and close. No to unhide a sheet. Is this possible to do without having to use a userform? Thank you ** Posted via: http://www.ozgrid.com Excel Templates, Training, Add-ins & Business Software Galore! Free Excel Forum http://www.ozgrid.com/forum *** Hi Sub test() Select Case MsgBox("Pick one", vbYesNoCancel, "Yo!") Case vbYes Ms...

Analytical Accounting
Hi, One of my Client's is considering to go down AA path with approx 300,000 AA dimension codes. I would like to hear whether such data set is manageable from Query wizard etc. appreciate your thoughts. Good Morning PR, I found that the issue isn't the number of AA Trx Dim Codes it is the size of the AAG30000 and AAG40000 tables the more entries the longer it takes to product the report. I had one client that started having a cached SSRS report with AA information as a management level report and a different SSRS report with a more restrictive dataset for reporting ...

Getting a specific parent of any node via xpath navigation
I am storing my site structure as such: <menuItems> <menuItem> <pageID>1</pageID> </menuItem> <menuItem> <pageID>2</pageID> <menuItem> <pageID>4</pageID> <menuItem> <pageID>5</pageID> <menuItem> <pageID>6</pageID> </menuItem> </menuItem> </menuItem> </menuItem> <menuItem> <pageID>3</pageID> ...

Change code with code?
Hi All..... I've got 31 Excel .xlsm files to modify the "Change Event" macro in. Is it possible to open and perform this with code, or must I do each one by hand? TIA Vaya con Dios, Chuck, CABGx3 If it is the same change in each sheet, it would probably be just as easy to go into the VBE, double click on the first sheet, make the correction, then copy that correction and double click the second sheet, delete and paste. Repeat the process 30 times. Takes less time than writing the code to do it. "CLR" <CLR@discussions.microsoft.com> wr...

Access 2003
I have a form that goes to a subform for searching. It works perfectly on my computer; however, when another user opens it and attempts to perform a search, they receive the Error Code 2455 message. When I debug, it gets stuck on "Me.book_subform.Form.Filter = strWhereSearch" and says that book_subform cannot be found. It isn't a rights issue, it isn't a mapping issue. What am I missing? check your naming. This is an issue that often confused. In this syntax: Me.book_subform.Form.Filter > = strWhereSearch book_subform is the name of the subform control on the main ...

Write a code by code
How can I write a code from procedure to some Workbook's ThisWorkbook? With procedure1 a make Workbook with a table. I need to write Auto_Close procedure to ThisWorkbook which makes some controls before I close it. Is it possible? <jenista.j@discussions.microsoft.com> wrote in message news:0be501c52fab$ba0b6830$a601280a@phx.gbl... > How can I write a code from procedure to some Workbook's > ThisWorkbook? With procedure1 a make Workbook with a table. > I need to write Auto_Close procedure to ThisWorkbook which > makes some controls before I close it. Is it possible? ...

Coding Duplicate Records
How can I code that a record is to be "K" kept or "D" deleted when compared to its next row? Example: A sorted file by Address BEFORE LastName Address Sales Date Keep/Delete 1. WASSEM 0N642 TITUS PL 67,500 6/25/2001 2. HART 0N655 E WEAVER CIR 70,000 3/19/2001 3. HART 0N655 E WEAVER CIR 40,000 3/19/2001 4. HART 0N655 WEAVER CIRCLE 33,700 6/19/1998 5. POYTH 0N662 W WEAVER CIR 294,690 6/21/2000 6. BLAND 0N670 GREEN PL ...

use IUrlHistoryStg2 to get the history record,but how to get the user name ?
IUrlHistoryStg2 can tell you the url,titile,some visited time information.But how can I know who visit this url ? Anyone can give me some hint or code ? Thanks very much ...