I'm currently working on a Silverlight solution that accepts Unicode characters and displays these correctly, however the text boxes don't seem to accept foreign characters such as Japanese (I'm trying Hiragana at the moment) and Chinese. These can be copied from the clipboard however when changing the language bar in Windows these characters cannot be entered. Is this a common problem and how should this be handled?
Any help much appreciated
Related
I've to read datamatrix barcodes (vda 4902, gtin, gs1) which use non-printable chars as seperator.
The goal is to scan the barcode with intermec or honeywell hardware and send it to a c# mvc webapplication.
The printable characters are received by the webapplication, but the non-printable chars not.
I've scanned the code to the VI editor on a linux server - bere i can see the special characters. But i couldn't get it with a asp.net to work nor a c# windows form application.
So currently i don't know where to look at...
Most likely if you are passing values to another page or webservice, you are forgetting the step of properly encoding the characters you are sending. You should probably look at using something like System.Web.HttpServerUtility.HtmlEncode. This function properly converts special characters in the value you are sending to an alternate representation that gets decoded on the receiving end.
Depending on other specifics would you did not elaborate on your original question, there are many other ways to encode/escape characters for purposes like this. But the above is what I would suggest starting with if you are not clear.
I'm using sharpPDF dll (http://sharppdf.sourceforge.net) to create PDF's in C#. Everything works great but I don't get any special characters (actually these are Polish letters such as "ą, ć, ł, Ó...") in my output. I'm saving strings in that PDF.
Is there any way to get that working?
Thanks.
Unfortunately SharpPDF has a lot of issues with special characters and there is no evolution planned for a correction of the special characters problem.
Sorry.
My question might be a little bit confusing, but I think it's still worth of paying some attention.
Basically I'm designing a program to display all printable Unicode characters in a RichTextBox.
I'm using VC# 2010 Express Edition.
However, the RichTextBox has a critical problem: some special characters cannot be displayed correctly.
For example, some Korean Characters (ᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑᄒ), can be displayed correctly in Microsoft Word. After I copy to the RichTextBox, the characters cannot be displayed correctly. However, when I copy back to Microsoft Word, it can be displayed correctly.
Therefore, it's a display problem (the characters themselves are correct). I guess it might be a font problem.
Some related property info:
RichTextBox.Font.GdiChaSet
RichTextBox.Font
How can I solve it? So that all printable Unicode characters can be displayed correctly (using different fonts for different CharSets are acceptable).
Actually, I need further assistance about removing all formatting when pasting
rtbxFileContent.Paste(DataFormats.GetFormat(DataFormats.Text)); // DataFormats.UnicodeText
I still need to have all printable characters to be displayed correctly, but without any formatting (except font).
Thanks.
Hope I made myself understood.
I hate sounding like MS Office Clippy, but your questions seems a lot like this one.
Essentially, you're not mad, it is hard. You could try reading/writing the text manually, using UTF8Encoding and BinaryWriter/BinaryReader.
I found the font "Arial Unicode MS" can almost solve my problem, but some characters from Char Sets looks weird to me. (Also, what if the user computer has not installed the font "Arial Unicode MS"?
So I'm still looking for a better universal solution to my question: automatically using different font for different Char Sets in the RichTextBox.
Thanks.
When writing Hebrew to a database the text is being written left to right when it should be right to left, as Hebrew is written right to left, my app is writing "hello" and it should be writing "olleh" (in Hebrew of course).
To read the Hebrew into my app I use System.Text.Encoding.GetEncoding(1255);
The text displays correctly in my app but when written to the database it is written left to right. My question is what am I missing when writing the text to the db?
Many thanks
Jonathan
Codepage 1255 encodes the text in logical, not visual order. Since you said it displays correctly in your app but not in your database, the most likely explanation is that the database tool does not support bidirectional text when you query it interactively. That does not matter, since the users don't directly query the database. Your app does, and then properly displays the bidirectional text.
Is your database set up with a sort order/collation that is right-to-left? For example, SQL Server sort order 138 = Dictionary order, case-insensitive, for use with the 1255 (Hebrew) character set.
Try with this encoding
Encoding.UTF8;
Encoding.GetEncoding("iso-8859-8");
I have a string that contains a czech character.
the string is "0bálka"
This string then gets used to create a file, and its part of the folder and filename.
but when I save the file, in windows explorer I get funny block characters in the name of the file.
Any idea how I can save this file with the valid czech characters preserved?
Two guesses what might be going on here:
The font used in Explorer doesn't cover that specific character. Unlikely, since á is hardly a special character.
The more likely variant would be that your source file encoding in C# is non-Unicode, gets interpreted as some random codepage (probably CP 1252 or 1251) and the resulting character you use is something entirely different than what you wrote in the source file. And then the font issue appears.
You can save your source file with a specific encoding in Visual Studio by clicking "Save as ..." in the File menu, then click the little arrow at the right of the save button and then select "Save with encoding". You should then pick a value such as "Unicode (UTF-8 with signature) - Codepage 65001" from the list.
Your windows should have czech language to be able to show the correct file name, this is not related to c#.
Don't worry, this is to do with how windows is displaying the filename, it may still have the correct name if you change your windows regional settings.
However you need to be careful what encoding you use when you save text to files.
You can learn some general background on what might be happening here:
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)