Home   Archive   Permalink

Foreign Language Characters ?

How can you use japanese characters with rebol ?
chars: {
chars just shows ?'s in the rebol console and prints ぉ.

posted by:   Andrew       19-Sep-2017/19:11:03-7:00

While they might be problematic at the console, they should be fine when you include them in UTF-8 encoded scripts/messages. Rebol 2 uses 8-bit strings so they'll appear as multiple characters, however both Rebol 3 and Red support higher characters--you can also enter them at the console by using their hex character code:

posted by:   Chris       19-Sep-2017/19:54:22-7:00

I should say that they'll still be usable in Rebol 2, however the actual string composition will be thus:

posted by:   Chris       19-Sep-2017/19:59:12-7:00

is it possible to use unicode standard version 10.0 ?

posted by:   Andrew       19-Sep-2017/20:40:54-7:00

What in particular are you trying to do?

posted by:   Chris       19-Sep-2017/21:19:12-7:00

I'm writing a password generator which just picks randomly from a string of characters.
chars0: {abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}
chars1: {0123456789}
chars2: {,.!@#$%^&*()-=_+[]{}\|/?'";:<>`~ }
chars3: {ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをゔゕゖ}
allChars: rejoin [chars0 chars1 chars2 chars3]
passLen: to-integer ask "length of password : "
longPass: {}
loop passLen [append longPass pick random allChars length? allChars]
print longPass

posted by:   Andrew       19-Sep-2017/22:00:52-7:00

In at least the case of R3-Alpha, the problem of why the console does not deal with unicode is due to conflicting interests in getting things like cursor up and down to page through the history vs. getting OS-level support for non-ASCII characters.
The crux of the problem is here:
Long story made short, the way that particular hook was written it gets a byte at a time but doesn't know what to do if it gets an extended character, hence you see those ?s.
Red's GUI console does not have this problem, nor does Ren Garden (which also does Arabic right-to-left)
The R3-Alpha console, while on "life support" in some sense, is also being kept alive by making more of its behavior userspace.

posted by:   Fork       20-Sep-2017/5:45:24-7:00

See also this post regarding some details of unicode when using the codepoint syntax in Rebol2/R3-Alpha:

posted by:   Fork       20-Sep-2017/5:50:33-7:00