“我能吞下玻璃而不伤身体”这句话的出处可以追溯到哈佛大学学生Ethan Mollick在1997年创造的一个名为
“I Can Eat Glass”的项目。
这个项目的初衷是教会人们用非母语说一句简单而地道的话,以令母语者感到惊讶和尊重。
后来,这句话被哥伦比亚大学的UTF-8样本项目采用,并改进为“我能吞下玻璃而不伤身体”,最终成为Ubuntu等系统中文字体测试的常用内容。
此外,这句话也因被用作乱码测试的示例而广为人知。
UTF-8转wchar_t:
[code]wstring utf8_to_wchar(const string& utf8_str) { wstring result; for (size_t i = 0; i < utf8_str.size();) { const uint8_t c = utf8_str; if (c = utf8_str.size()) break; const uint8_t c1 = utf8_str; const wchar_t wc = ((c & 0x1F) = utf8_str.size()) break; const uint8_t c1 = utf8_str[i + 1]; const uint8_t c2 = utf8_str[i + 2]; const wchar_t wc = ((c & 0x0F) |