Upgrade to Pro — share decks privately, control downloads, hide ads and more …

the world of characters

orisano
September 13, 2018
1.2k

the world of characters

orisano

September 13, 2018
Tweet

Transcript

  1. 1จࣈͷੈք
    @orisano

    View full-size slide

  2. Έͳ͞Μ
    จࣈΛ਺͑ΒΕ·͢ΑͶʁ

    View full-size slide

  3. Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔
    ͫ͗
    ͢
    L̠ͨͧͩ͘
    G̴̻͈͍͔̹
    ̑͗̎̅͛
    ́
    Ǫ̵̹̻̝̳
    ͂̌ ̌͘! ͖̬̰̙̗
    ̿̋ ͥ
    ͥ̂ͣ̐́́͜͞

    View full-size slide

  4. Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔
    ͫ͗
    ͢
    L̠ͨͧͩ͘
    G̴̻͈͍͔̹
    ̑͗̎̅͛
    ́
    Ǫ̵̹̻̝̳
    ͂̌ ̌͘! ͖̬̰̙̗
    ̿̋ ͥ
    ͥ̂ͣ̐́́͜͞ => 6

    View full-size slide

  5. Έͳ͞Μ
    όΠτ਺Λ਺͑ΒΕ·͔͢ʁ
    (UTF-8)

    View full-size slide

  6. Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔
    ͫ͗
    ͢
    L̠ͨͧͩ͘
    G̴̻͈͍͔̹
    ̑͗̎̅͛
    ́
    Ǫ̵̹̻̝̳
    ͂̌ ̌͘! ͖̬̰̙̗
    ̿̋ ͥ
    ͥ̂ͣ̐́́͜͞

    View full-size slide

  7. Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔
    ͫ͗
    ͢
    L̠ͨͧͩ͘
    G̴̻͈͍͔̹
    ̑͗̎̅͛
    ́
    Ǫ̵̹̻̝̳
    ͂̌ ̌͘! ͖̬̰̙̗
    ̿̋ ͥ
    ͥ̂ͣ̐́́͜͞ => 143

    View full-size slide

  8. ͋ͳ͕ͨࢥ͏1จࣈ͸
    Ͳ͏਺͑Δ΂͖͔ʁ

    View full-size slide

  9. byte਺Ͱ͸਺͑ΒΕͳ͍

    View full-size slide

  10. Unicode͸จࣈू߹
    จࣈͱ਺஋͕ରԠ͢Δ

    View full-size slide

  11. ͜ͷ਺஋ͷ͜ͱΛ
    ίʔυϙΠϯτ
    ͱݺͿ

    View full-size slide

  12. ͜ͷίʔυϙΠϯτΛ
    byteྻͰදݱ͢Δํ๏Λ
    ΤϯίʔσΟϯάͱ͍͏

    View full-size slide

  13. UTF-8ͱ͔UTF-16ͱ͔͸
    ΤϯίʔσΟϯάͷҰछ

    View full-size slide

  14. ͱΓ͋͑ͣ
    ίʔυϙΠϯτΛ਺͑Ε͹
    ղܾʁ

    View full-size slide

  15. =>
    1F468 + 200D + 1F469 +
    200D + 1F466

    View full-size slide

  16. ࣮͸ෳ਺ͷίʔυϙΠϯτͰ
    ҰͭͷจࣈʹͳͬͨΓ͢Δ

    View full-size slide

  17. ਓ͕ؒೝ͍ࣝͯ͠Δ̍จࣈ͸
    ॻهૉ(Grapheme cluster)
    ͱݺ͹Ε͍ͯΔ

    View full-size slide

  18. Ͳ͏΍Ε͹
    ίʔυϙΠϯτͷྻ͔Β
    ॻهૉΛऔΓग़ͤΔ͔

    View full-size slide

  19. ίʔυϙΠϯτ͕ؒ
    ॻهૉڥքʹͳΔ͔Ͳ͏͔ͷ
    ݫີͳϧʔϧ͕͋Δ

    View full-size slide

  20. UAX #29
    Unicode Text Segmentation

    View full-size slide

  21. ͜ΕΛJSͰ࣮૷ͯ͠·ͨ͠
    github.com/orisano/graphemesplit

    View full-size slide

  22. ৄ͘͠͸ UAX #29 Λݟͯ
    http://unicode.org/reports/tr29/

    View full-size slide

  23. ݟ஌Β͵ਓʹʓจࣈͱ
    ݴΘΕͨͱ͖ʹ͸
    ͪΌΜͱ֬ೝ͠Α͏ʂ

    View full-size slide

  24. 1 byte?
    1 codepoint?
    1 grapheme cluster?

    View full-size slide