Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
the world of characters
Search
orisano
September 13, 2018
8
1.3k
the world of characters
orisano
September 13, 2018
Tweet
Share
More Decks by orisano
See All by orisano
OSS Performance Tuning Tips
orisano
8
5.5k
Docker-Compose & BuildKit
orisano
4
940
Container Build Talk
orisano
3
2.4k
dockerignore talk
orisano
2
6.9k
Better docker image+
orisano
6
5.8k
Socket.IO Introduction
orisano
0
3k
Profiling Go Application
orisano
11
7.6k
Multi-stage Builds Patterns & Practice
orisano
6
5k
better docker image
orisano
22
30k
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Making Projects Easy
brettharned
115
5.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.9k
YesSQL, Process and Tooling at Scale
rocio
167
14k
The Power of CSS Pseudo Elements
geoffreycrofte
72
5.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
How STYLIGHT went responsive
nonsquared
95
5.2k
Typedesign – Prime Four
hannesfritz
39
2.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Transcript
1จࣈͷੈք @orisano
Έͳ͞Μ จࣈΛ͑ΒΕ·͢ΑͶʁ
a
a => 1
͋
͋ => 1
佛
佛 => 1
None
=> 1
None
=> 1
Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ ͫ͗ ͢ L̠ͨͧͩ͘ G̴̻͈͍͔̹ ̑͗̎̅͛ ́ Ǫ̵̹̻̝̳ ͂̌
̌͘! ͖̬̰̙̗ ̿̋ ͥ ͥ̂ͣ̐́́͜͞
Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ ͫ͗ ͢ L̠ͨͧͩ͘ G̴̻͈͍͔̹ ̑͗̎̅͛ ́ Ǫ̵̹̻̝̳ ͂̌
̌͘! ͖̬̰̙̗ ̿̋ ͥ ͥ̂ͣ̐́́͜͞ => 6
Έͳ͞Μ όΠτΛ͑ΒΕ·͔͢ʁ (UTF-8)
a
a => 1
͋
͋ => 3
佛
佛 => 4
None
=> 4
None
=> 18
Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ ͫ͗ ͢ L̠ͨͧͩ͘ G̴̻͈͍͔̹ ̑͗̎̅͛ ́ Ǫ̵̹̻̝̳ ͂̌
̌͘! ͖̬̰̙̗ ̿̋ ͥ ͥ̂ͣ̐́́͜͞
Z͑ͫ̓ͪ̂ͫ̽ ̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ ͫ͗ ͢ L̠ͨͧͩ͘ G̴̻͈͍͔̹ ̑͗̎̅͛ ́ Ǫ̵̹̻̝̳ ͂̌
̌͘! ͖̬̰̙̗ ̿̋ ͥ ͥ̂ͣ̐́́͜͞ => 143
͋ͳ͕ͨࢥ͏1จࣈ Ͳ͏͑Δ͖͔ʁ
byteͰ͑ΒΕͳ͍
Unicodeจࣈू߹ จࣈͱ͕ରԠ͢Δ
͋ => 3042
=> 1F914
͜ͷͷ͜ͱΛ ίʔυϙΠϯτ ͱݺͿ
͜ͷίʔυϙΠϯτΛ byteྻͰදݱ͢Δํ๏Λ ΤϯίʔσΟϯάͱ͍͏
UTF-8ͱ͔UTF-16ͱ͔ ΤϯίʔσΟϯάͷҰछ
ͱΓ͋͑ͣ ίʔυϙΠϯτΛ͑Ε ղܾʁ
͍͍͑
=> 1F468 + 200D + 1F469 + 200D + 1F466
࣮ෳͷίʔυϙΠϯτͰ ҰͭͷจࣈʹͳͬͨΓ͢Δ
ਓ͕ؒೝ͍ࣝͯ͠Δ̍จࣈ ॻهૉ(Grapheme cluster) ͱݺΕ͍ͯΔ
Ͳ͏Ε ίʔυϙΠϯτͷྻ͔Β ॻهૉΛऔΓग़ͤΔ͔
ίʔυϙΠϯτ͕ؒ ॻهૉڥքʹͳΔ͔Ͳ͏͔ͷ ݫີͳϧʔϧ͕͋Δ
UAX #29 Unicode Text Segmentation
None
͜ΕΛJSͰ࣮ͯ͠·ͨ͠ github.com/orisano/graphemesplit
ৄ͘͠ UAX #29 Λݟͯ http://unicode.org/reports/tr29/
ݟΒ͵ਓʹʓจࣈͱ ݴΘΕͨͱ͖ʹ ͪΌΜͱ֬ೝ͠Α͏ʂ
1 byte? 1 codepoint? 1 grapheme cluster?