How does Zalgo text work?

独自空忆成欢 提交于 2019-12-21 02:00:53

问题


I've seen weirdly formatted text called Zalgo like below written on various forums. It's kind of annoying to look at, but it really bothers me because it undermines my notion of what a character is supposed to be. My understanding is that a character is supposed to move horizontally across a line and stay within a certain "container". Obviously the Zalgo text is moving vertically and doesn't seem to be restricted to any space.

Is this a bug/flaw/exploit/hack in Unicode? Are these individual characters with weird properties? "What" is happening here?


H̡̫̤̤̣͉̤ͭ̓̓̇͗̎̀ơ̯̗̱̘̮͒̄̀̈ͤ̀͡w͓̲͙͖̥͉̹͋ͬ̊ͦ̂̀̚ ͎͉͖̌ͯͅͅd̳̘̿̃̔̏ͣ͂̉̕ŏ̖̙͋ͤ̊͗̓͟͜e͈͕̯̮̙̣͓͌ͭ̍̐̃͒s͙͔̺͇̗̱̿̊̇͞ ̸̤͓̞̱̫ͩͩ͑̋̀ͮͥͦ̊Z̆̊͊҉҉̠̱̦̩͕ą̟̹͈̺̹̋̅ͯĺ̡̘̹̻̩̩͋͘g̪͚͗ͬ͒o̢̖͇̬͍͇͓̔͋͊̓ ̢͈͙͂ͣ̏̿͐͂ͯ͠t̛͓̖̻̲ͤ̈ͣ͝e͋̄ͬ̽͜҉͚̭͇ͅx͎̬̠͇̌ͤ̓̂̓͐͐́͋͡ț̗̹̝̄̌̀ͧͩ̕͢ ̮̗̩̳̱̾w͎̭̤͍͇̰̄͗ͭ̃͗ͮ̐o̢̯̻̰̼͕̾ͣͬ̽̔̍͟ͅr̢̪͙͍̠̀ͅǩ̵̶̗̮̮ͪ́?̙͉̥̬͙̟̮͕ͤ̌͗ͩ̕͡



回答1:


The text uses combining characters, also known as combining marks. See section 2.11 of Combining Characters in the Unicode Standard (PDF).

In Unicode, character rendering does not use a simple character cell model where each glyph fits into a box with given height. Combining marks may be rendered above, below, or inside a base character

So you can easily construct a character sequence, consisting of a base character and “combining above” marks, of any length, to reach any desired visual height, assuming that the rendering software conforms to the Unicode rendering model. Such a sequence has no meaning of course, and even a monkey could produce it (e.g., given a keyboard with suitable driver).

And you can mix “combining above” and “combining below” marks.

The sample text in the question starts with:

  • LATIN CAPITAL LETTER H - H
  • COMBINING LATIN SMALL LETTER T - ͭ
  • COMBINING GREEK KORONIS - ̓
  • COMBINING COMMA ABOVE - ̓
  • COMBINING DOT ABOVE - ̇



回答2:


Zalgo text works because of combining characters. These are special characters that allow to modify character that comes before.

OR

y + ̆ = y̆ which actually is

y + ̆ = y̆

Since you can stack them one atop the other you can produce the following:


y̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆

which actually is:

y̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆

The same goes for putting stuff underneath:


y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆



that in fact is:

y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆

In Unicode, the main block of combining diacritics for European languages and the International Phonetic Alphabet is U+0300–U+036F.

More about it here

To produce a list of combining diacritical marks you can use the following script (since links keep on dying)

for(var i=768; i<879; i++){console.log(new DOMParser().parseFromString("&#"+i+";", "text/html").documentElement.textContent +"  "+"&#"+i+";");}

Also check em out



Mͣͭͣ̾ Vͣͥͭ͛ͤͮͥͨͥͧ̾



来源:https://stackoverflow.com/questions/46184958/c%cc%a8%cc%a6%cc%ba%cc%a9%cc%b2%cc%a5%cd%89%cc%ad%cd%9a%cc%9c%cc%bb%cc%9d%cc%a3%cc%bc%cd%99%cc%ae%cc%af%cc%aao%cc%b4%cc%a1%cd%87%cc%98%cd%8e%cc%9e%cc%b2%cd%87%cc%a6%cc%b2%cd%9e%cd%a1m%cc%b8%cc%a9%cc%ba%cc%9d%cc%a3%cc%b9%cc%b1%cd%9a%cc%ac%cc%a5%cc%ab%cc%b3%cc%bc%cc%9e%cc%98%cc%af%cd%98%cd%85%e1%ba%b9%cd%87%cc%ba%cc%9c%cc%81%cc%95%cd%a2-what-kind-of-string

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!