I have some batch files that use a text file for language-independancy. Until yesterday all worked fine ... but then I began translating the standard texts to Dutch and German. Both languages use so called diacritical or accented characters like ä, ë, ö. I think Spanish will give the same problems with ñ. I created the text file with Notepad using standard encoding, which is ANSI. Just typing (DOS: TYPE) the file showed the wrong accented characters: e.g. ë showed as Ù. After I edited the text file and saved with Unicode encoding the DOS TYPE showed exactly what I typed in Notepad. At this point I thought my problem was solved ... but my batch code now shows me no text at all! All text is retrieved from the file by a batch file that looks like this (simplified):
@rem Parms %1 text type number File %%a program name
@rem %2 program name (double quoted) %%b - - filler (tabs)
@rem %3 text number %%c text number
@rem %4 replacement value - 1 %%d - - filler (tabs)
@rem %5 replacement value - 2 %%e text string
set TempText=
set TempType=
setlocal enabledelayedexpansion
@rem Read file until both values are set ...
for /f "usebackq tokens=1,2,3,4,5 delims=|" %%a in ("%EnvPath%Text.txt") do (
if /i %%a==Tools (if /i %%c==%1 (set TempType=%%e))
if /i %%a==%~2 (if /i %%c==%3 (set TempText=%%e))
if not "!TempType!"=="" (if not "!TempText!"=="" (goto :Leave))
)
:Leave
endlocal & set TempText=%TempText%&set TempType=%TempType%
When ECHO
is ON
it shows that no lines are read from the file or the FOR-loop is never executed.
My question is: how can I make the FOR loop to read the Unicode texts?