Now I make the for
statements as follow,
for (int i = 0; i < 256; i ++) {
printf("%5c", i);
}
And I want to get the real content with ASCII
Now I make the for
statements as follow,
for (int i = 0; i < 256; i ++) {
printf("%5c", i);
}
And I want to get the real content with ASCII
Provided your terminal is set to UTF-8 encoding, this piece of code
#include <stdio.h>
int main()
{
char s[] = { 0xf0, 0x9f, 0x98, 0x8e, 0 };
printf("%s", s);
}
outputs a smiley with sunglasses.
To find out how to encode other UNICODE characters use the top navigation bar on the page (or the previous/next angle brackets)
You can try to use Unicode instead of ASCII
This's an example on Swift
let dog = String(UnicodeScalar(0x1F436))
println(dog)
for codeUnit in dog.utf8 {
print("\(codeUnit) ")
}