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.
Related
I am using a Node.js chat server which sends ASCII messages containing the id of the users and unicode (utf16 - little endian) messages as text messages. How can I determine the type of encoding in the C# client?
Any given ASCII character has the same values in Unicode (if you're using UTF8). So the only way to know this is if one of the message characters is not an ASCII character.
A better way to figure this out is using a flag (either a bit, a character or multiple characters) that indicates whether something is a user id or a text message.
where can I find features list for qr codes ?
I mean I can encode everything which can be represented by a string.
Example what I'm looking for:
SMS - "sms:text"
Email - "mailtio:text"
Text - "Text"
Most devices support MeCard, Hyperlinks, Phone Numbers, Email Addresses, vCards, some support Wifi Settings, and text display. Look at this question for how to use a ZXing C# API.
A MeCard is a semicolon and colon delimited set of fields and might look like this
MECARD:N:Elliott Frisch;URL:frischcode.com;
A hyperlink starts with a protocol followed by a colon, not every device supports every protocol. (e.g. http: or ftp: or sms: or mailto").
Maybe this tutorial will help you
http://www.thonky.com/qr-code-tutorial/data-encoding/
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
I am having a problem where users are composing some large chunks of text in MS Word, then pasting that in to the online form. These get entered into the DB as an upside down ?. What are my options to replace these with standard quotes?
These smart quotes are a unicode point. All you need is a simple String.Replace to sort them out.
-edit- Something like:
mystring.Replace("\u201C","\"").Replace("\u201D","\"")
What are my options to replace these with standard quotes?
The best approach is not to replace them. People want to use “smart quotes”, let them. They're not aberrations that only exist in MS Word, they're perfectly valid Unicode characters, and if your application isn't storing non-ASCII characters right then there's a whole lot more that will go wrong than just smart quotes.
Use UTF-8 encoding for all your web pages and store your content in a Unicode-capable database (eg. if you are using SQL Server, use NVARCHAR) and you'll not only support smart quotes but also accents and other alphabets.
You should run the input through the HtmlEncode method, which will convert from or to and , allowing you to save those and other higher characters to a format that can be saved without hassle.
Should I also mention Joel's post again?
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
How can I print UTF8 characters in the console?
With Console.Writeline("îăşâţ") I see îasât in console.
Console.OutputEncoding = Encoding.UTF8;
There are some hacks you can find that demonstrate how to write multibyte character sets to the Console, but they are unreliable. They require your console font to be one that supports it, and in general, are something I would avoid. (All of these techniques break if your user doesn't do extra work on their part... so they are not reliable.)
If you need to write Unicode output, I highly recommend making a GUI application to handle this, instead of using the Console. It's fairly easy to make a simple GUI to just write your output to a control which supports Unicode.
Try this :
using System.Diagnostics
...
Debug.WriteLine(..);// will output utf-8 charset
Using Console.OutputEncoding will be sufficient for this. All string objects in .NET are by default unicode so changing output encoding for console to UTF-8 will work as you want in modern Windows installations.
Default encoding in console depends on configuration but it will be most likely IBM437 for US language or some local codepage.
You can't print Unicode characters in the console, it only supports the characters that are available in the current code page. Characters that are not available are converted to the closest equivalent, or a question mark.