FTP - BAT - special chars

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
brjohnsmith
Posts: 1
Joined: 11 Jun 2016 19:04

FTP - BAT - special chars

#1 Post by brjohnsmith » 11 Jun 2016 19:34

Hi,

I have some files to be downloaded by FTP, and I am using MS-DOS batch to do it. The problem is that the files have special chars that on FTP represents some letters, but on Windows are stored the other way. For example

File: AAAãê.txt

I dont have problem to download the file, the problem is that when I list in ms-dos and compare the list netween FTP and MS-DOS, and we find the difference. See below the sequence.

1. list the files on ftp and save the list in txt.
2. download the file in the txt.
3. list the files on ms-dos folder and compare with list on FTP <--- this is the problem
4. delete only the files that were found it.

does anyone know how can I do to compare ftp file and ms-dos file including this special chars?

tks.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: FTP - BAT - special chars

#2 Post by penpen » 12 Jun 2016 06:34

This is probably a codepage issue.

I assume the ftp server uses UTF-8, and the active codepage of your command shell is 850.
So the character ƈ (=U+C688) (ftp server side) is translated to the bytes (in hex) C6 88,
and your command shell uses cp 850 to read the characters ãê (=U+00E3, U+00EA).

Without seeing your complete implementation, i'm unsure why there is a difference when comparing the resulting file with the name within your command shell -
except you somehow use different codepages again (on your system).

Depending on your implementation it may help if you change the codepage first:

Code: Select all

@chcp 65001
:: download and compare


penpen

Post Reply