14,954
edits
| Line 106: | Line 106: | ||
<td>"\x is a string escape code, which happens to use hex notation" (hexadecimal notation)<ref>[https://stackoverflow.com/questions/13123877/difference-between-different-hex-types-representations-in-python Difference between different hex types/representations in Python - Stack Overflow]</ref></td> | <td>"\x is a string escape code, which happens to use hex notation" (hexadecimal notation)<ref>[https://stackoverflow.com/questions/13123877/difference-between-different-hex-types-representations-in-python Difference between different hex types/representations in Python - Stack Overflow]</ref></td> | ||
<td>hexadecimal to text ↔ text to hexadecimal</td> | <td>hexadecimal to text ↔ text to hexadecimal</td> | ||
</tr> | |||
<tr> | |||
<td>String starting from {{kbd | key=<nowiki>&#</nowiki>}} symbols</td> | |||
<td style="word-wrap: break-word;">{{kbd | key=<nowiki>&#35937;</nowiki>}}</td> | |||
<td>Unicode HTML code</td> | |||
<td></td> | |||
</tr> | </tr> | ||
</table> | </table> | ||
| Line 203: | Line 209: | ||
for each_unicode_character in hex_notation.decode('utf-8'): | for each_unicode_character in hex_notation.decode('utf-8'): | ||
print(each_unicode_character) | print(each_unicode_character) | ||
</pre> | |||
=== String starting from &# symbols === | |||
Using PHP<ref>[https://blog.longwin.com.tw/2011/06/php-html-unicode-convert-2011/ PHP 將 文字 轉換成 &#xxxxx; UNICODE 碼 | Tsung's Blog]</ref> | |||
<pre> | |||
$unicode_html = '&#128024;'; | |||
echo mb_convert_encoding($unicode_html, 'UTF-8', 'HTML-ENTITIES') . PHP_EOL; // print 🐘 | |||
$input = "🐘"; | |||
$unicode_html = base_convert(bin2hex(mb_convert_encoding($input, 'UTF-32', 'utf-8')), 16, 10); | |||
$unicode_html = '&#' . $unicode_html . ';'; | |||
echo 'unicode_html: ' . $unicode_html . PHP_EOL; // print 🐘 | |||
</pre> | </pre> | ||