1

I have a bunch of unicode (UTF-16LE) xml files that I want to transfer via an old OLD vb6 ftp component, but when I send them through there, they turn to ANSI on the ftp server side (win2k3 server).

When I attempt to send it using the windows terminal ftp client, it works fine whether I use binary or ascii transfer mode. The file stays unicode. What could be possible causes of this?

Edit: perhaps unrelated, but I notice sending files through an old email component also does this to unicode files.

cc0
  • 1,960
  • 7
  • 40
  • 57
  • What is the actual encoding of the file? (UTF-8, UTF-16LE, etc?) – Thanatos Mar 30 '11 at 08:11
  • 2
    Does the old VB6 component distinguish between text and binary mode? If so, it should be switched to binary mode. – Joachim Sauer Mar 30 '11 at 08:15
  • 1
    It does not, everything is hardcoded to do binary. However I tried to transfer a file using ascii mode with the windows terminal ftp client, and that did not have any effect on the encoding itself. – cc0 Mar 30 '11 at 08:22
  • 2
    @cc0: then the most probable answer is that your ancient component is simply broken and does some binary-to-text conversion that's unnecessary and breaks your use case. – Joachim Sauer Mar 30 '11 at 08:34
  • 2
    Do you treat the file as text in VB? As far as I remember VB6 used Unicode internally but used the ANSI functions pretty much everywhere so you didn't gain anything of it except that all your strings are double the size. – Joey Mar 30 '11 at 08:36
  • 1
    @Joey - thanks, I think you might be on to something. I will delve into the source again and see what sense I can make of it. – cc0 Mar 30 '11 at 08:43
  • 1
    Perhaps the library converts strings to ANSI, but leaves byte arrays untouched. In that case, try assigning the string to a byte array (without using `StrConv`, just a simple assignment). This preserves the UTF-16 encoding. – Philipp Mar 30 '11 at 12:52
  • Joey was correct. Thanks for the feedback Joachim and Philipp, the story concludes here: http://stackoverflow.com/questions/5496110/writing-ansi-string-to-unicode-file-over-ftp – cc0 Mar 31 '11 at 11:56

1 Answers1

0

The answer was finalized here; Writing ANSI string to Unicode file over FTP

Community
  • 1
  • 1
cc0
  • 1,960
  • 7
  • 40
  • 57