I have code:
string text = sampleTextBox.Text;
and I’m wondering in what encoding text is? Is it utf16 (as it is string) or maybe it is my operating system encoding?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s all Unicode, basically – there’s no conversion between the .NET textual types (
char/string) and binary going on, so there’s no encoding to worry about.You potentially need to worry about surrogate pairs to get from the UTF-16 textual representation of
charandstringto full UTF-32, but that’s slightly different to the normal encoding issues.Philosophically, a textbox contains text, not binary data. You should only be thinking about encodings when there’s a conversion to a binary format – such as a file.