uce/site/demo/utf8.uce

62 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

String string_to_hex(String s)
{
String result = "";
for(auto c : s)
{
result += to_hex(c);
}
return(result);
}
RENDER(Request& context)
{
String raw = first(context.post["raw"], "■👪▧▲🏳🌈😂👋🏽😆😏😱🇦🇽Udø島リZ̸̢̧̡̧̗̰̪͉̤͖͉̪̝̦͎̮̑͜a̸̧̝̱̹̲̗̪̰̦͒̃͋̿̿̃̈͑̐͑͗̚̕̚͝͠l͚̜͕̠̣ģ̸̧̘̜͇͚͈͙̓̌̅͑͊͊͋̓́͌̈́̿̈́͗͘̚ͅͅȏ̶̗̤̳͎̫̥͕̣͔̥̙̜̰̂͌̍͊͂́̅̇̒̕̕ルイ社もなく");
<>
<link rel="stylesheet" href='style.css'></link>
<h1>
<a href="index.uce">UCE Test</a>:
UTF-8
</h1>
<form action="?" method="post">
<div>
<label>split_utf8</label>
<input type="text" name="raw" value="<?= raw ?>"/>
</div>
<div>
<input type="submit" value="Submit Form"/>
</div>
</form>
Simple Characters
<pre><?
u32 item_idx = 0;
for(auto seg : split_utf8(raw))
{
item_idx++;
print(string_to_hex(seg), " ", seg, "\t");
if(item_idx % 4 == 0)
print("\n");
}
?></pre>
Compound Characters
<pre><?
item_idx = 0;
for(auto seg : split_utf8(raw, true))
{
item_idx++;
print(string_to_hex(seg), " ", seg, "\t");
if(item_idx % 4 == 0)
print("\n");
}
?></pre>
<pre><?= var_dump(context.params) ?></pre>
</>
}