{"katakana": [
{"ucs": "30AB", "utf-8": "E382AB", "kana": "カ", "info": "katakana letter KA"},
{"ucs": "30AC", "utf-8": "E382AC", "kana": "ガ", "info": "katakana letter GA"},
{"ucs": "30AD", "utf-8": "E382AD", "kana": "キ", "info": "katakana letter KI"},
{"ucs": "30AE", "utf-8": "E382AE", "kana": "ギ", "info": "katakana letter GI"},
{"ucs": "30AC", "utf-8": "E382AC", "kana": "ガ", "info": "katakana letter GA"},
{"ucs": "30AD", "utf-8": "E382AD", "kana": "キ", "info": "katakana letter KI"},
{"ucs": "30AE", "utf-8": "E382AE", "kana": "ギ", "info": "katakana letter GI"},
{let katakana-array:{Array-of Katakana} = {new {Array-of Katakana},
{Katakana "30AB", "E382AB", "カ", "katakana letter KA"},
{Katakana "30AC", "E382AC", "ガ", "katakana letter GA"},
{Katakana "30AD", "E382AD", "キ", "katakana letter KI"},
{Katakana "30AE", "E382AE", "ギ", "katakana letter GI"},
{Katakana "30AC", "E382AC", "ガ", "katakana letter GA"},
{Katakana "30AD", "E382AD", "キ", "katakana letter KI"},
{Katakana "30AE", "E382AE", "ギ", "katakana letter GI"},
Of course both could have been reduced to mere arrays of strings, but then the iteration over the data would use no tags or keys. The Curl version is tagged, but internally:
{define-value-class public final Katakana
field private constant ucs-code:String || = "0000"
field private constant utf8-code:String || = "000000"
field private constant kana-char:String || = {String '\u5B57'} || "字"
field private constant kana-name:String || = "Ji"
{getter public {ucs}:String
{return self.ucs-code}
}
{getter public {utf-8}:String
{return self.utf8-code}
}
{getter public {katakana}:String
{return self.kana-char}
}
{getter public {character}:String
{return self.kana-name}
}
{constructor {default ucs:String, utf:String, kana:String, info:String}
set self.ucs-code = ucs
set self.utf8-code = utf
set self.kana-char = kana
set self.kana-name = info
}
}
{include "./katakana-unicode.scurl"}
field private constant ucs-code:String || = "0000"
field private constant utf8-code:String || = "000000"
field private constant kana-char:String || = {String '\u5B57'} || "字"
field private constant kana-name:String || = "Ji"
{getter public {ucs}:String
{return self.ucs-code}
}
{getter public {utf-8}:String
{return self.utf8-code}
}
{getter public {katakana}:String
{return self.kana-char}
}
{getter public {character}:String
{return self.kana-name}
}
{constructor {default ucs:String, utf:String, kana:String, info:String}
set self.ucs-code = ucs
set self.utf8-code = utf
set self.kana-char = kana
set self.kana-name = info
}
}
{include "./katakana-unicode.scurl"}
The iterator block accesses each instance as, e.g., val.ucs and so forth.
In fairness, the JSON could have been
{"katakana-array": [
but it further complicated iterating over the data.
In the Curl applet the Curl data is processed dramatically faster, naturally.
Note: the UTF-8 can be used to urlencode: "E382B6" becomes %E3%82%B6 for a URL.
Here is one result using the Curl data: (click to view)
The applet is located at www.aule-browser.com/kanji/kana-charts.html
No comments:
Post a Comment