User:Oleg Kobchenko/Unicode Test Drive

From J Wiki
Jump to: navigation, search

A big appeal of Unicode is liberation from the constraints of a code page, bringing the ability to display various glyphs side by side. That similar to what we do with freehand writing -- we don't pause to think, which font or code page do I pick to write that.

Exotic Symbols

The great tool on Mac OS X, the Character Palette, has a search field. So you just type "chess" and it responds with a list "White Chess King", "White Chess Queeen", etc., or "greek pi" and you are instantly zoomed in on the right glyph. With a click it gets it into the carret position.

Now with Unicode support in J, you get this freedom for illustration in messages, comments, anywhere text or group of symbols can be.

Chess.png

Linear text does not need any trasformation, just whatever fits between the ' '. However, to apply structural operations, such as reshape, it better be converted to the Unicode type with the u: verb.

Notation

Unicode brings about many items of mathematical notation to fairly rich extent, not TeX yet, but far more expressive than ASCII.

Msg.png

Localization

One of the primary reasons for Unicode practical usefulness is ability to express text in most languages in one stream of characters, again, not worying about code pages.

I18n.png

Here a simple localization system is implemented in J. Localized messages with the same name are put into different locales based on language. Switch to a different language for all the text is done with assignment to a locative. However, it is possible to display different labguages side by side, just by using the different locales directly:

   '"',msg3_i18nRU_,'" means "',msg3_i18nEN_,'"'
"при комплексном c = " means "for complex c = "