Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I have sites written in Win-1250 alias cp150. I need to convert all files to UTF-8. I know about iconv but I found problem with this tool. When I tried to convert I had to make a copy of the original file. But I have many files in (sub)folders. So If I would want to use iconv instead, I would need to convert all files from *.php to *.tmp and than copy or rename back to *.php. This looks too difficult. Any other way how to do it, something intelligent and simple?
You already have the utility (iconv). You simply have to find the files to be converted and then decide where to put the converted files. (This is the "intelligent and simple" way to do it)
One possibility:
Create a directory where all the converted files will go. Suppose it is "nufiles". Then, simply do this:
Code:
for filename in *; do iconv <options> $filename > nufiles/$filename; done
If the files are in many different places, then something like this:
Code:
for filename in $(find <path> -name "*.php*") do
iconv <options> $filename > tmpfile
mv tmpfile $filename
done
Returns:
iconv: file „www/information/select,“ cannot open: file not found
iconv: file „insert,“ cannot open: file not found
iconv: file „update.txt“ cannot open: file not found
My hunch is that you need to look thru all your subfolders and find whatever is causing this----starting with how $filename gets set to that long string.
When you find the directory with the evidence, run the command there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.