WAD FOR reads Text in ASCII !??!?

If I read a line from a listfile

R:\_SyncDirs_\5_DOWN\Down\Books, Documents and Manuals\Schnäppchen.pdf

with
FOR %line% in (@FileList) DO Echo Line:%line%
then the result is
Line:R:\_SyncDirs_\5_DOWN\Down\Books, Documents and Manuals\Schnõppchen.pdf

This lead allways to an error, because in the next steps the Copy-Command will not find the file.
The list are created by FFIND .....

How can I avoid it ?
 
May 20, 2008
11,411
99
Syracuse, NY, USA
Shouldn't that work seamlessly if one is properly set up for one's own (European) language? It even works here with ASCII output if I merely CHCP to 1252.
Code:
v:\> chcp 1252
Active code page: 1252

v:\> ffind /b schn* > filelist

v:\> for %line in (@filelist) do copy %line empty\
V:\Schnõppchen.pdf => V:\empty\Schnõppchen.pdf
  1 file copied
V:\Schnõppchen.pdf.2 => V:\empty\Schnõppchen.pdf.2
  1 file copied

The spaces in Peter's path could be a problem if he's not quoting %line%.
 
You're creating the file by redirecting the output of FFIND? Make it Unicode by doing OPTION //UNICODEOUTPUT=YES before doing the redirection.

I've do it, Charles as I see Your reply to vefatica DO - Problem - and it works ! :smile:
but I must immediatly "re-switch" it after the redirection, because I wont have the other (following) Outputs in Unicode :android:

@vefatica:Dont worry, the rest of the Action will go on with
Copy "%line" "%target%" /HEVX
:smile:
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
Shouldn't that work seamlessly if one is properly set up for one's own (European) language? It even works here with ASCII output if I merely CHCP to 1252.

It sounds like he's writing text as one code page, and reading it back as another. I don't know exactly how it happens, but I do know that character 0xE4 is lowercase A with umlaut in Windows ("ANSI") code pages 1250 and 1252, but lowercase O with tilde in OEM code pages 850 and 858.

I'd agitate for removing all support for 8-bit code pages, but that would pretty well scuttle backwards compatibility.
 
It sounds like he's writing text as one code page, and reading it back as another. I don't know exactly how it happens, but I do know that character 0xE4 is lowercase A with umlaut in Windows ("ANSI") code pages 1250 and 1252, but lowercase O with tilde in OEM code pages 850 and 858.

I'd agitate for removing all support for 8-bit code pages, but that would pretty well scuttle backwards compatibility.

For clarification: Both actions are in one script ! At first I'm looking with FFIND (onto an USB-Drive) for files and if there are found some, then I try to copy them with the FOR - Loop. I never change the code page (why should I do such things :rolleyes:)
So only TCC can be the bad guy ..:smile:
 
Jan 12, 2014
426
7
Switzerland, SO
For clarification: Both actions are in one script ! At first I'm looking with FFIND (onto an USB-Drive) for files and if there are found some, then I try to copy them with the FOR - Loop. I never change the code page (why should I do such things :rolleyes:)
So only TCC can be the bad guy ..:smile:
If you have umlauts IN the script itself (I don't know your exactly script), then the script itself can be the problem, if it's for example in UTF instead ANSI (Codepage 1252) ... and NOT TCC IMHO.

So ensure, that your script is saved in the correct codepage. If you have for example Notepad++ as editor, the default is UTF-8 (without BOM) and NOT ANSI (I believe) - so you would have to convert and save it to ANSI!

Edit: Even if your ffind is without umlauts, the script file codepage could be relevant ... I make some tests ...

Edit 2: Maybe I have it :-) it can be, that your windows GUI is set to CP1252 and your Console inclusive TCC is set to CP850 (this is the default on related systems), so a ffind maybe procudes a "false umlaut" in the filelist ...
 
Last edited:
Jan 12, 2014
426
7
Switzerland, SO
So, here a the detailled tests and a possible solution (used TCMD 18.00.27) ...

Okay, I was successful with the following steps:

1. Same codepage for Windows GUI and Windows Console

I have set the same codepage for Windows GUI and Windows Console (means DOS Prompt AND TCC/TCMD Console) as follow:

In the RegKey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]

I have change the Key "OEMCP" to the same value as Windows GUI has. For example: on an US-english system, the default Windows Codepage is probably 1252 and OEMCP is probably 437; on a Swiss-German system (as here), the default Windows Codepage is probably 1252 and the default OEMCP is 850.

So I had to change to "OEMCP"="1252".


2. Reboot the system


3. Ensure, that your filename with umlauts on your USB drive has correct umlauts within Windows GUI.


4. Ensure, that your TCMD/TCC is NOT set to Unicode (NOT set!)


5. Then I have the following results with manually typed commands within TCC:

copywithumlauts.JPG



5. Create your batch

After you can create your batch/script. SAVE IT IN ANSI 1252, NOT in UTF or so! I you edit your script, you have eventually to convert and save it as ANSI 1252 first!

I have created this test.btm ...

Code:
@echo off
cls

w:
cd "\_SyncDirs_\5_DOWN\Down\Books, Documents and Manuals"

ffind /b schnäppchen.pdf > filelist
rem for %line in (@filelist) do echo "%line"
for %line in (@filelist) do copy "%line" testfile.txt

pause
exit


6. Test it

copywithumlauts2.JPG



With this solution, change to Unicode (and back) should be NOT necessary!

Greetings from Switzerland!

Alpengreis
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Tab (^t) in @FILEWRITE's text Support 2
R Bug TPIPE's pdf to text conversions don't work Support 2
Joe Caverly Using TYPE with non-English text Support 22
M Goto fails when a text endtext block precedes the code Support 5
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
S INPUT fails if the entered text contains pair of square brackets Support 6
Alpengreis List command: text truncated in find box (german) Support 9
vefatica Text invisible in v25 Support 10
S How to? What's the maximum size of the thread text ? Support 5
E Text copy bug Support 1
S FFIND text that includes " Support 7
S Setting Tabs=Bottom makes text turn black Support 6
Joe Caverly Multiple Text Searches at once using FFIND or TPIPE Support 4
AndrewJ TakeCommand v23 + ANSI color sequences leads to black on black text Support 6
D Grabbing html text with @line Support 3
M TCC screen text bright colors not as bright in 24 as 23 Support 5
vefatica Find Files/Text dialog: does it work? Support 0
Alpengreis Installer: text is still truncated in german language Support 2
Peter Murschall IDE destroys Text on Ctrl-U/Ctrl-Shift-U Support 12
WinLanEm Read Cyrillic text from a file Support 12
Charles Dye OSD loses ampersands in text Support 2
R How to? Display text same as in CMD Support 14
Glenn Bowes Strange text at startup Support 5
M Fixed Cannot use the "Browse..." function in "Find files/text" dialogbox Support 2
B Documentation Reference/Windows X64: Redundant text at the end Support 0
Joe Caverly LIST /T (search for Text) Support 2
nikbackm How to? Find duplicate lines in text file Support 0
J Input text converts to uppercase Support 1
T How to? Select and Delete text Support 6
vhodro How to? Select text Support 10
D Highlighted Text Color? Support 2
vefatica Fixed No text in List View! Support 4
D Removing text with TPIPE Support 2
Frank locked file after "text > ..." Support 3
Joe Caverly Copying text of MSGBOX Support 0
Stefano Piccardi TPIPE and word to text conversion Support 4
A How to? filter text stream with a regular expression Support 11
Charles Dye Text selection in Take Command tab window Support 13
rconn Full text instant email notification Support 31
WadeHatler Any way to restore the Text Based "Select File" Windows in TCC Support 2
Jay Sage Function to Return Selected Text Support 2
mdwyer @replace - global use in a text file Support 3
E Line break in msgbox text Support 3
D Force For to treat set of values as text, not files Support 3
L command grouping with TEXT...ENDTEXT Support 1
R Misalignment of text Support 2
Jay Sage How Can SENDMAIL Create Messages with Plain Text and HTML Support 2
dcantor Help text for Date Formats Support 0
A Selecting text is very dificult with a background image Support 1
P if and text: bug or feature? Support 2

Similar threads