Unicode question (revisited, question for Rex)

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
A question for Rex:

If I "ECHO %@CHAR[27]" and then *copy* that single character from the console to the clipboard via QuickEdit,

if %@clip[0] == %@char[27] fails, and
if %@clip[0] == %@char[8592] succeeds.

That's no surprise since the console glyph is the Unicode 8592 and the clipboard contents are Unicode.

However if I use TCC keystrokes to select/yank (^Y) that character from the screen to the clipboard, the results of those tests are reversed. They're also reversed if I "ECHO %@char[8592] > clip:". That is

if %@clip[0] == %@char[27] succeeds, and
if %@clip[0] == %@char[8592] fails.

Since redirected output is ASCII, I figure you're translating 8592 into 27 before putting ASCII text in the clipboard. How do you do that? Is it just WideCharToMultiByte? When I try that (with CP_ACP) 8592 turns into 63 (the question mark ... unprintable). If I try it specifying CP437 it turns 8592 into 27. But my TCC uses CP437! I'm confused.

Thanks.