glfwSetWindowTitle(win, "Nämen");
变成“N?men”,其中 '?'有点黑,扭曲的方 block ,说明无法显示该字符。
如何显示 'ä'?
最佳答案
如果要在窗口标题中使用非 ASCII 字母,则字符串必须采用 utf-8 编码。
The window title is a regular C string using the UTF-8 encoding. This means for example that, as long as your source file is encoded as UTF-8, you can use any Unicode characters.
如果您看到一个黑色的、扭曲的小方 block ,那么这表明 ä
是使用某种非 UTF-8 的 iso 编码编码的,可能类似于 latin1。要解决此问题,您需要在编辑器中打开它,您可以在其中更改文件的编码,将其更改为 uft-8(无 BOM)并修复标题中的 ä
。
关于c++ - 无法在 GLFW 窗口标题中显示 'ä',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58801165/