Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

FTP client and national characters

Posted on 2004-10-28
11
Medium Priority
?
631 Views
Last Modified: 2012-06-21
Hi!

I'm writing an FTP client in VB.NET for educational purpose, so using an third party FTP client is not an option.
I'm having problem with sending the CWD command (Change Working Directory) to the FTP Server running IIS 6.
It works as expected with non-national characters, but when i try to change to a directory with national characters in the name, it doesn't work!
The server replies with code 550, file not found.

I've tried sending the command and directory name encoded in both UTF-7 and UTF-8, without success.
How do i make this work with national characters?

Any help appreciated!

Regards
Kristoffer
0
Comment
Question by:CyberStoffe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
11 Comments
 
LVL 4

Expert Comment

by:andrewharris
ID: 12442115
DOes the IIS Server have the applicable character set installed?

Andrew
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12443029
Do other ways (like in a NT command prompt FTP session) accept the national characters?

Bob
0
 

Author Comment

by:CyberStoffe
ID: 12444070
andrewharris:
Don't know if the IIS Server has the applicable character set installed. Where do I check it?

TheLearnedOne:
It doesn't work in a NT command prompt FTP session, but other FTP clients are able to change to the directory with national characters.

/Kristoffer
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 96

Expert Comment

by:Bob Learned
ID: 12446372
Do you have anything that can shed a little more light on the situation?  Sample code, FTP site address, etc.?

Bob
0
 

Author Comment

by:CyberStoffe
ID: 12446952
The part of the code where I send the command to the FTP Server looks like this:

    Dim command As String = "CWD Images" & vbNewLine
    Dim buffer() As Byte = System.Text.Encoding.ASCII.GetBytes(command)
    Dim stream As NetworkStream = TcpClient.GetStream()

    stream.Write(buffer, 0, buffer.Length)

The FTP Server is on my local network and is running IIS 6 on Windows Server 2003.
The language version of Windows Server is swedish, and i'm having problem with changing to a directory with a swedish character in the directory name. It works with IE and other FTP Clients, bot not with the code above and not with the FTP command prompt utility.

In the response from the server (550 File not found), the national character is replaced with a question mark.

/Kristoffer
0
 
LVL 4

Expert Comment

by:andrewharris
ID: 12449493
Just out of curiosity, what do you get from PWD on the dir that contains the dir with the swedish chars?

Andrew
0
 

Author Comment

by:CyberStoffe
ID: 12449764
I managed to get the right characters back in the server response by using UTF7 encoding when I convert the byte array to a string.
No question marks anymore.

But it still says "550 File not found" when i send a CWD command encoded in UTF7.
Enclosing the directory name in double quotes doesn't make any difference.

If I send a LIST command, the directory list returned looks OK.
The national characters are displayed correctly.

/Kristoffer
0
 
LVL 14

Accepted Solution

by:
AvonWyss earned 1000 total points
ID: 12453960
Turning the server into UTF8 mode (RFC-2640 compliant) would be using the
OPTS UTF8 ON
command. The server should return 220 UTF8 OPTS ON (or so) if supported (can be queried using FEAT). Afterwards, all textual data (dir/file names, dir listings, etc.) will be UTF8.

If that does not work, I'd suggest to use Encoding.Default - which is usually the ISO-8859-1 in Europe. I know that there is a risk that this does not match the server encoding, but the chances are good that it will work with FTP servers using English charsets as well as with geographically close FTP servers using the same (or a similar) encoding.
0
 

Author Comment

by:CyberStoffe
ID: 12454025
Thanks for your help, AvonWyss!

Encoding.Default did the trick!
I also tried to send OPTS UTF8 ON to the server, but it responded "501 option not supported".

/Kristoffer
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 12454030
Perfect. Hopefully, more servers will support the UTF8 option in the future, because this gets rid of endcoding issues for good...
0
 

Author Comment

by:CyberStoffe
ID: 12454033
...and of course thanks to anyone else who have tried to help me!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question