Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm having some trouble uploading text files using sftp. The trouble is, that the files on my (windows) client are utf-8 encoded, but after the upload they seem to be us-ascii encoded (at least file -bi says so).

The files have not been converted, I think only the meta data about the encoding is wrong. Is there any way to change that information? (Preferably multiple files/directories at once)

I've tried uploading using FileZilla as well as WinScp, with different configurations (force utf-8 enabled, automatic etc...), but had no luck avoiding the issue.

share|improve this question
    
There is no metadata about encoding in a text file. This is why you should explicit it in most programming languages. What are you trying to do?. Which is inside those files?. How are you trying to open them?. –  Javier Rivera Jan 30 '12 at 9:27
    
They're mostly .php code files. All I want to do is access them through the browser. (The Ubuntu machine serves as Apache web server) –  Envyrus Jan 30 '12 at 9:29
add comment

1 Answer 1

up vote 0 down vote accepted

Text files don't usually have any meta data. You just have to know what's inside yourself. Actually, on Ubuntu the default 'locale' (i.e. the default way to interpret text files) is also utf-8, so if it doesn't work for you then it's the specific program that doesn't support it, not the OS.

Note that us-ascii is a subset of utf-8, so the only way to tell the difference would be to scan the entire file for the multibyte characters, and you probably don't have any (unless you're writing in Chinese or Arabic or something).

share|improve this answer
    
You are quite right... I'm such an idiot, when testing a file that actually contains characters that differ from ASCII, the type is UTF-8. Thank you! –  Envyrus Jan 30 '12 at 9:45
    
BTW, I don't think file scans the whole of large files, so it might sometime report ASCII even though there's a UTF-8 char somewhere near the end. –  ams Jan 30 '12 at 9:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.