Uploading file to ftp server with arabic name(encoding error)

1.7k Views Asked by At

I am trying to upload a file whose name is written in Arabic language to ftp server, and i succeed in uploading the file but i have a problem at the ftp server, where the uploaded file name is incorrect and take unreadable format like "????????" or "*************" or any format other than Arabic.

I have tried to encode file name to UTF-8 or "Default" ANSI encoding but failed what can i do to solve this problem ? Here is the following code which used to encode file path in VB .Net:

FIleNamePath = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(FIleNamePath))

Thanks in advance

1

There are 1 best solutions below

0
On

If I understand you right the problem is, that the conversion of any string with your code should generate you the original string.

dim input = "abcü"
dim output = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(input))
assert.areEqual(input, output)

For me this code works (with German umlauts).

So maybe your input is not a UTF-8 string? Try to check what Encoding.UTF8.GetBytes produces (how many characters, try to manual convert is, ...)