Search found 470 matches

by Liviu
19 Apr 2014 00:43
Forum: DOS Batch Forum
Topic: Synthesizing Unicode strings in Windows 7 batch
Replies: 4
Views: 3808

Re: Synthesizing Unicode strings in Windows 7 batch

@aGerman thanks. I know how popular Unicode is in batch world, of course but I still think it's an overlooked topic for now, which will become as commonplace as LFNs as time goes. Back to code now, and just to wrap up the original post, it is also possible to synthesize Unicode strings off their UTF...
by Liviu
14 Apr 2014 19:39
Forum: DOS Batch Forum
Topic: WMIC and FOR /F : A fix for the trailing <CR> problem
Replies: 21
Views: 12576

Re: WMIC and FOR /F : A fix for the trailing <CR> problem

Maybe it was from an unhappy student who couldn't find the CMD prompt on the school or library computer It _is_ possible to disable the prompt (and batch execution altogether) via "group policies" on both workstation and server versions of Windows, but that's not the default and it's not n...
by Liviu
14 Apr 2014 17:11
Forum: DOS Batch Forum
Topic: WMIC and FOR /F : A fix for the trailing <CR> problem
Replies: 21
Views: 12576

Re: WMIC and FOR /F : A fix for the trailing <CR> problem

I've heard the CMD is already missing under the newest Windows server versions. CMD is alive and well up to the latest Server 2012 R2 (the server edition of 8.1 - http://technet.microsoft.com/library/hh831786.aspx ). Actually, Server versions have had the "Core" option for a while now, wh...
by Liviu
13 Apr 2014 23:31
Forum: DOS Batch Forum
Topic: Synthesizing Unicode strings in Windows 7 batch
Replies: 4
Views: 3808

Synthesizing Unicode strings in Windows 7 batch

Given the newfound UTF-8 codepage 65001 support in Windows 7, it has become possible to effectively build arbitrary Unicode strings in batch code using the hex representation of their UTF-8 encoding. This did not - and to the best I can guess, couldn't possibly - work in XP, and it's an interesting ...
by Liviu
13 Apr 2014 15:54
Forum: DOS Batch Forum
Topic: WMIC and FOR /F : A fix for the trailing <CR> problem
Replies: 21
Views: 12576

Re: WMIC and FOR /F : A fix for the trailing <CR> problem

Because the issue comes up again and again I did some tests that should show what actually happens. Nice detective work there Now, some guesswork below... Some issues remain open: - Why does CMD remove the BOM? (Or is it only prepended if you redirect to a file?) Think it's the latter. CMD itself d...
by Liviu
09 Apr 2014 20:59
Forum: DOS Batch Forum
Topic: REPLVAR.BAT - regex search and replace for variables
Replies: 32
Views: 12396

Re: REPLVAR.BAT - regex search and replace for variables

Liviu you talk about the method on your code using for /f for input a variable encoded as utf-8 mulitbyte. But this will works, not use the for /f Please re-read my previous post: " Your code saves the variable to a UTF-8 file, but never reads it back from the UTF-8 file - which is the real di...
by Liviu
09 Apr 2014 10:44
Forum: DOS Batch Forum
Topic: REPLVAR.BAT - regex search and replace for variables
Replies: 32
Views: 12396

Re: REPLVAR.BAT - regex search and replace for variables

I copy this code from my other thread. Is a similar code the Liviu code. I think that this would be a way for catch a unicode variable and reinput to the cmd from batch. Your code saves the variable to a UTF-8 file, but never reads it back from the UTF-8 file - which is the real difficulty here. In...
by Liviu
09 Apr 2014 10:38
Forum: DOS Batch Forum
Topic: japanase cmd
Replies: 17
Views: 7149

Re: japanase cmd

I found a solution for use the utf 8 codepage using a batch script on windows xp. This is the trick ( chcp 65001 >nul echo do something rem restore the codepage chcp 850 >nul ) This has been known to work, and has been used before to, for example, convert a file to UTF-8. You can find examples of t...
by Liviu
08 Apr 2014 22:05
Forum: DOS Batch Forum
Topic: japanase cmd
Replies: 17
Views: 7149

Re: japanase cmd

/U ouput text as utf-16 (without the bom) /A output text as multibyte (convert utf-16 to multibyte using the current codepage) Then for a lossless unicode input, the utf-16 should be converted to multibyte using a codepage 65001 (utf-8) or 65000 (utf-7). That's what the code I posted as "replV...
by Liviu
08 Apr 2014 17:24
Forum: DOS Batch Forum
Topic: japanase cmd
Replies: 17
Views: 7149

Re: japanase cmd

Carlos, and please don't take it the wrong way, but I think you are confusing yourself more than needed by jumping into Japanese codepages before fully exploring the common issues present in the - relatively simpler case of - western languages. I'm convinced that cmd internally stores the text using...
by Liviu
08 Apr 2014 12:12
Forum: DOS Batch Forum
Topic: REPLVAR.BAT - regex search and replace for variables
Replies: 32
Views: 12396

Re: REPLVAR.BAT - regex search and replace for variables

Here is a simple test case. [...] set a variable to extended ASCII 0xC8: [...] It looks like the direct read witht he S option is working, and the piped method is failing. But all is not as it seems. Why, it is exactly as it seems. If, instead of piping to repl, you do just an "echo %input% | ...
by Liviu
08 Apr 2014 11:44
Forum: DOS Batch Forum
Topic: japanase cmd
Replies: 17
Views: 7149

Re: japanase cmd

I run a new cmd and change the codepage to 65001, then I run the script that works using the codepage for japanase (932), and it not works, not saved the content of the variable. The screenshots look like XP, and XP batch parsing is known to be broken under codepage 65001 - your script doesn't exec...
by Liviu
08 Apr 2014 00:08
Forum: DOS Batch Forum
Topic: REPLVAR.BAT - regex search and replace for variables
Replies: 32
Views: 12396

Re: REPLVAR.BAT - regex search and replace for variables

Rightly or wrongly, I've come to the conclusion that letting JScript read environment variables directly is always going to create problems when dealing with extended ASCII codes >127 (0x7F). That's odd. You said that the previous version was writing the correct strings to stderr, which means that ...
by Liviu
07 Apr 2014 21:12
Forum: DOS Batch Forum
Topic: REPLVAR.BAT - regex search and replace for variables
Replies: 32
Views: 12396

Re: REPLVAR.BAT - regex search and replace for variables

Rightly or wrongly, I've come to the conclusion that letting JScript read environment variables directly is always going to create problems when dealing with extended ASCII codes >127 (0x7F). That's odd. You said that the previous version was writing the correct strings to stderr, which means that ...
by Liviu
06 Apr 2014 17:15
Forum: DOS Batch Forum
Topic: REPLVAR.BAT - regex search and replace for variables
Replies: 32
Views: 12396

Re: REPLVAR.BAT - regex search and replace for variables

The really weird thing is, I can write the final result to stderr, but when I try to write the same final string to stdout it throws the exception. That's odd, indeed. Actually, it's not all that odd. What happens is that stderr is not captured by for/f and goes directly to the console as full Unic...