Euro character messed up during FTP transfer

Posted by djechelon on Server Fault See other posts from Server Fault or by djechelon
Published on 2012-12-15T11:11:23Z Indexed on 2012/12/15 17:05 UTC
Read the original article Hit count: 182

Filed under:
|
|

My customer is using a very outdated ecommerce management system on my hosting service. For that product, no support is being provided anymore by the vendor.

Brief explanation: the shop website, that claims to run under LAMP stack, is built by an old Visual Basic Windows application running on MS Access. The user constructs the shop, defines the HTML template, adds products and categories, etc.

Then the VB exe builds the PHP pages (one for each template page) and the SQL script to run on MySQL. It also uploads everything via FTP and runs the installation/upgrade script on its own.

The problem

Browsing the website, many products' descriptions are cut before the euro sign. For example, what was supposed to be "Product price €1000" becomes "Product price"

The analysis

  • MySQL contains a cutted description until the € sign, so it's not PHP fault
  • The Access databases contain full description with € sign, so it's not fault of the webmaster writing bad description or eDisplay cutting them
  • The SQL that will run once the site gets uploaded, stored on my local machine before upload, contains the € sign
  • The same script, after being FTPed by eDisplay and opened with nano from SSH, shows the € sign messed up like this:
  • vsftpd log reports (obfuscated for privacy) Sat Dec 15 11:16:57 2012 22 xxx.xxx.128.13 1112727 /srv/www/domains/xxxxxx.it/htdocs/db.sql b _ i r xxxxxxx ftp 0 * c which seems to be a binary transfer (and also a huge security vulnerability because you can download the whole database from unauthenticated HTTP)
  • The eDisplay internal FTP client provides no option for ascii/binary transfer modes
  • [Add] Trying to manually upload the SQL file via SFTP shows messing up euro
  • [Add2] Trying to manually upload using Xftp client with explicit ASCII mode doesn't fix too

It looks like the file gets uploaded as binary. Perhaps on the customer's previous host it all worked fine because that was a Windows host.

The server

It's an Azure virtual machine running openSUSE 12.2 with both vsftpd and openSSH

The question

Without asking the customer to manually upload files using FileZilla or replacing with €, because he refuses, what can I do on server side to prevent vsftpd to screw up euro sign?

© Server Fault or respective owner

Related posts about ftp

Related posts about vsftpd