2

I'm trying to make a "search" button in my Win32-based application (written in C++/MFC.) I don't have much space in the window itself, so the button must be small. So I added this Unicode "search" character U+1F56C or "" as a "caption" to the button:

enter image description here

It looks OK in the resource editor in VS 2008:

enter image description here

but when I compile and run the app, the button looks like this:

enter image description here

PS1: Note that the project is compiled to use "Unicode character set."

enter image description here

PS2: The reason I'm trying to add it as text is so that the button can scale well in case of a higher DPI setting.

c00000fd
  • 20,994
  • 29
  • 177
  • 400
  • with `SetDlgItemText(hwndDlg, IDC_BUTTON1, L"\xD83D\xDD0D");` this work – RbMm Aug 16 '17 at 23:56
  • 1
    or you need save your `rc` file as unicode. close it in VS, open say in notepad, and select `Save As` with `Unicode` encoding. after that you can insert in rc file symbol as is – RbMm Aug 17 '17 at 00:13
  • 1
    Are you using a different font for the button control? Possibly that character isn't in the font you're using. – 1201ProgramAlarm Aug 17 '17 at 00:48
  • 1
    @RbMm: Oh, wow. I didn't know that VS will be so obtuse to save the `.rc` file with an 8-bit `ANSI` encoding. Wow! So that fixed that issue... – c00000fd Aug 17 '17 at 04:52
  • @1201ProgramAlarm: although now when I compile and run the app it shows the "" symbol fine on Windows 10 or 8.1 but on my test Win7 the button is displayed as two hollow squares. So is there a way to know if a certain Unicode character is supported by the system font that's used to display dialog UI? – c00000fd Aug 17 '17 at 04:54
  • 1
    Your struggling too hard with this. Use a glyph. – David Heffernan Aug 17 '17 at 07:14
  • @DavidHeffernan: A "glyph". Can you explain? – c00000fd Aug 17 '17 at 07:17
  • An image. Use an image. – David Heffernan Aug 17 '17 at 07:21
  • Am I missing something? Magnifier has [U+1F50D](http://www.fileformat.info/info/unicode/char/1f50d/index.htm) (left) or [U+1F50E](http://www.fileformat.info/info/unicode/char/1f50e/index.htm) (right). U+1F56C is ["Bullhorn With Sound Waves"](http://www.fileformat.info/info/unicode/char/1f56c/index.htm). I must admit that I cannot see the images (due to security policy of my company). – Scheff's Cat Aug 17 '17 at 08:29
  • Possibly a duplicate of [Is it possible to use unicode characters in a Win32 resource file?](https://stackoverflow.com/q/21897512/1889329). – IInspectable Aug 17 '17 at 15:21
  • @Scheff: Well, I guess C encoding for this UTF-32 character is `L"\xD83D\xDD0D"` as was shown above. The issue is that it is UTF-32, so in other words, it's encoded with two `wchar_t`s. I was able to save it in a .rc file, but now I can't seem to find a way to know if the system font supports it. For instance, I would've thought `GetFontUnicodeRanges` API allows that, but I can't see how to use it with UTF-32 characters? – c00000fd Aug 17 '17 at 17:15
  • @IInspectable: It's not just about saving Unicode symbols in a resource file. I need to be able to display it in my dialog window (see my comment above this one.) – c00000fd Aug 17 '17 at 17:16
  • You appear to be confusing the terms *code unit*, *code point*, and *encoding*. `L"\xD83D\xDD0D"` is the UTF-16 *encoding* for the *code point* U+1F50D. Being outside the base multilingual plane (BMP) it requires two *code units* to encode. The proposed duplicate answers one of your two questions. This is not strictly a duplicate, because you have mangled two (or three) questions into one. – IInspectable Aug 18 '17 at 08:21
  • @IInspectable: than I suggest moving it into a linguistics forum. – c00000fd Aug 18 '17 at 18:53

0 Answers0