Jump to content

Unicode strings: Difference between revisions

m
rewording
No edit summary
m (rewording)
Line 1:
{{draft task}}
The task is to demonstrate how one is expected to handle Unicode strings. The provided solution should show:
Demonstrate how one is expected to handle Unicode strings. Some example considerations: can a Unicode string be directly written in the source code? How does one do IO with unicode strings? Can these strings be manipulated easily? Can non-ASCII characters be used for keywords/identifiers/etc (see [[Unicode variable names]])? What encodings (UTF-8, UTF-16, etc) can your language accept without much trouble?
 
* How Unicode strings are represented in source code
* How to perform input and output using Unicode strings
* Examples of string manipulation
* Encodings supported by the language (eg UTF-8, UTF-16, etc)
 
=={{header|C}}==
C is not the most unicode friendly language, to put it mildly. Generally using unicode in C requires dealing with locales, manage data types carefully, and checking various aspects of your compiler. Directly embedding unicode strings in your C source might be a bad idea, too; it's safer to use their hex values. Here's a short example of doing the simplest string handling: print it.<lang C>#include <stdio.h>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.