Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

DO ... /P ... and Unicode?

May
12,846
164
In the example below, the first command produces a correct filename. In the second and third, something gets lost in the translation.
Code:
c:\users\vefatica\desktop> dir /b /f *void*
C:\Users\vefatica\Desktop\www.voidtools.com • View forum - Everything.URL

c:\users\vefatica\desktop> do x in /p dir /b /f *void* ( echo %x )
C:\Users\vefatica\Desktop\www.voidtools.com ò View forum - Everything.URL

c:\users\vefatica\desktop> echo %@execstr[dir /b /f *void*]
C:\Users\vefatica\Desktop\www.voidtools.com ò View forum - Everything.URL
 
I'll bet they both work better after an OPTION //UNICODEOUTPUT=YES.
 
I'll bet they both work better after an OPTION //UNICODEOUTPUT=YES.
Yeah, but should that be necessary to get DO /P and @EXECSTR to work right? I'd expect any temp files created for those purposes to be Unicode by default. It's known in advance that their contents will be used as input. Now that you mention it, piping suffers in a similar (but slightly different) fashion. Below, in the second command, there should be a box-like (unprintable) character where the bullet belongs.
Code:
v:\> everything voidtools
C:\Users\vefatica\Desktop\www.voidtools.com • View forum - Everything.URL

v:\> everything voidtools | for /f "tokens=*" %x in (@con:) do echo %x
C:\Users\vefatica\Desktop\www.voidtools.com • View forum - Everything.URL

Since I can't know in advance, should I always use "OPTION //UNICODEOUTPUT=YES" before DO /P or @EXECSTR? If "yes", I'd rather TCC did it for me.
 
It would be nice if TCC could look into the future and determine with 100% certainty what commands you're going to be running next. It might even be possible, provided I eliminate aliases, variables, and plugins.

You also want TCC to know in advance what external apps are going to be writing to a pipe -- that's a bit harder.

And you want it done before TCC even knows what the command is going to be, because redirection is done before the command (internal or external) is executed.

(I don't suppose you care that it would destroy any semblance of CMD compatibility when redirecting or piping.)
 

Similar threads

Back
Top