Incorrect chars when upload files [SOLVED]

Advertisement

leofire
Donor
Joined:
Posts:
2
Location:
Italy

Incorrect chars when upload files [SOLVED]

Hi to all,

I'm trying to upload PHP file with this chars:
ì,é,è,ç,ò,°,#,à,§,ù

but when I reopen file I obtain this result:
ì,é,è,ç,ò,°,#,,§,ù

To fix this, at the moment, I need to edit file (double click on winscp remote screen), change manually this strange chars (for example ì and change to ). When I save and reopen it I can see the correct chars.
There is a manner to fix this issue?
Thanks in advance,

Leonardo
Last edited by leofire on 2013-10-23 16:57; edited 1 time in total

Reply with quote

Advertisement

Guest

Hi prikryl,

thanks for your suggestion. I have tried with different FTP account but any result.
I have change the option to UTF-8 to "attivo" (Active), I can login correctly but still anything... :(

With this option you can upload the file correctly ?
Thanks in advance,

Leonardo

Reply with quote

Guest

Could you try to upload this file and check it please ?
With other FTP client I can upload correctly.
Thanks in advance,

Leonardo
Description: Strange Chars (rename to PHP and upload with Winscp)

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Incorrect chars when upload files

Sorry, I've misunderstood your problem.
Does this problem happen when you simply upload the file or when you open it in an editor (internal or external?) from WinSCP and save it?

Reply with quote

Guest

Hi prikryl,

I just upload the files with à,ò,ì and when I open it (via shell or through winscp editor) I cannot see the correct chars.
Thanks for your help,


Leonardo

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Your file is in UTF-8 encoding, but lacks BOM. WinSCP internal editor opens the file using ANSI encoding, when it lacks BOM, by default. You can switch to UTF-8 in the editor or make WinSCP default to UTF-8 in preferences:
https://winscp.net/eng/docs/ui_editor
https://winscp.net/eng/docs/ui_pref_editor

As for the shell: Your terminal client probably defaults to ANSI encoding too. It's also possibly that your host does not use UTF-8 encoding.

Reply with quote

leofire
Donor
Joined:
Posts:
2
Location:
Italy

Solved!

Hi prikryl,

thanks for your right suggest, you're great!
I have changed the editor to UTF8 and now I can see the correct chars when I use the
I have also added the header in PHP like this:
header('Content-Type: text/html; charset=utf-8');
and I can see all chars correctly!
If I try to use a str_replace in order to replace à with a it works perfectly!
Probably vi from shell use the same encoding.
Many thanks for your suggest and have a good day,

Leonardo

Reply with quote

Advertisement

You can post new topics in this forum