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:
    
"^(3041)^(3042)^(3043)...etc"

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:
    
"^(E3)^(81)^(81)^(E3)^(81)^(82)^(E3)^(81)^(83)...etc"

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:
    
https://github.com/metaeducation/ren-c/blob/master/src/os/posix/host-readline.c#L424
    
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)
    
https://i.stack.imgur.com/UPP0e.png
    
The R3-Alpha console, while on "life support" in some sense, is also being kept alive by making more of its behavior userspace.
    
https://github.com/metaeducation/ren-c/blob/a5a72bd5bc0c9ae995fd9f72d83904e6af671c67/src/os/host-console.r#L236

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:
    
https://stackoverflow.com/questions/15077974/how-to-use-unicode-codepoints-above-uffff-in-rebol-3-strings-like-in-rebol-2

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



Name:


Message:


Type the reverse of this captcha text: "m u n - g s m"



Home