Serge Hulne
Serge Hulne

Reputation: 614

How do I use a Unicode table to print a Tibetan character

Here is the Unicode characters table for the Tibetan language,

https://en.m.wikipedia.org/wiki/Tibetan_(Unicode_block)

How to I use the codes in that chart in a fmt.Printf(mycode) statement, in order to print, say the Tibetan letter ཏ, which is located at line U+0F4x and column F of that unicode chart.

Do I have to write:

Fmt.Printf(“U+0F4xF”)

or something like that, or do I have to drop the “U” or the “U+“ ?

Upvotes: 1

Views: 87

Answers (1)

Flopp
Flopp

Reputation: 1947

To print ཏ (U+0F4F TIBETAN LETTER TA) (or any other Unicode character), you can put the character directly into your string literal, use a \u0F4F escape, or use the correspoding rune (Unicode codepoint):

fmt.Printf("Direct: ཏ\n")
fmt.Printf("Escape: \u0F4F\n")
fmt.Printf("Rune: %c\n", rune(0x0F4F))

The Go blog has some details...

Upvotes: 4

Related Questions