By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!C:\>ver
TCC 26.01.35 x64 Windows 10 [Version 10.0.17763.914]
C:\>option unicodeoutput
unicodeoutput=No
C:\>echo **%@char[160]** > clip:
C:\>type clip:
** **
C:\>type /x clip:
0000 0000 2a 2a ff 2a 2a 0d 0a ** **..
C:\>
That would screw everything up.It works as expected here. You might try with OPTION //UNICODEOUTPUT=YES.
v:\> echo **%@char[160]** > clip:
v:\> type /x clip:
0000 0000 2a 2a e1 2a 2a 0d 0a **á**..
OEMCP = 437I don't understand that. What's your OEM code page?
echo " " > clip:
Rex, you've been saying for some time now — rightly! — that we should be using Unicode instead of 8-bit character sets. May I suggest that the same principle should apply to clipboard reads and writes? In version 27? CF_TEXT is dead, long live CF_UNICODETEXT!
I really thought I'd get a NBSP in the clipboard ... because I wanted to paste it (IIRC) into a forum post. Charles seems to have figured out that "> clip:" uses CP_OEMCP. If that's not CP_ACP, oddball things will happen, likeWhy on earth would you want to put a non-spacing character into the clipboard? (And what do think you'd get if you did??)
But if you really want to, ask Microsoft, because it's their clipboard code.
v:\> echo *%@char[177]* > clip:
v:\> echo *%@char[177]*
*±*
v:\> echo %@line[clip:,0]
*▒*
v:\> type clip:
*¦*
v:\> chcp 437
Active code page: 437
v:\> echo *%@char[177]* > clip:
v:\> echo *%@char[177]*
*±*
v:\> echo %@line[clip:,0]
*±*
v:\> type clip:
*±*
There is no way you can get a non-spacing Unicode character in the clipboard when you're using ASCII output.
Switch to UTF-8 or UTF16 output. And then you still won't be able to paste it into a forum post, because it's not a character, it's the *lack* of a character. (But the value will be in the clipboard.)
HGLOBAL hMem = GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, 107 * sizeof(WCHAR));
WCHAR *pszChars = (WCHAR *) GlobalLock(hMem);
// @char[160] ~ @char[265] plus terminating NUL, all supported by Consolas
for ( INT i=0; i<106; i++ )
pszChars[i] = 160 + i;
pszChars[106] = 0;
OpenClipboard(NULL);
SetClipboardData(CF_UNICODETEXT, hMem);
d:\projects2019\denom\x64\release> echo %@clip[0]
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉ
d:\projects2019\denom\x64\release> type clip:
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿAaAaAaCcCc
You have seen the result of that. UnicodeOutput=No and UTF8Output=yes are my defaults.I mean, set UnicodeOutput=No, UTF8Output=yes and use `chcp 65001`. Does that change the problem?
Redirection to the clipboard is always done using UTF16 Unicode.
>:u Redirected output is UTF16 Unicode