Gossamer Forum
Quote Reply
charset
Does anyone know an easy way of converting the charset in a .txt or .html document from iso-8859-1 to UTF-8.

The alternative is to add some code to a script that will convert UTF-8 to iso-8859-1 during import to mySQL.

I've got text in both charsets that I want to add to the same pages and so have to convert one or other.

Many thanks.
Quote Reply
Re: [Alba] charset In reply to
To do the alternative, try this code:

$variable =~ s/([\x{80}-\x{FFFF}])/'&#' . ord($1) . ';'/gse;
Quote Reply
Re: [afinlr] charset In reply to
Thanks for your reply.

I'm using 2 scripts;

1. uses lwp::simple getstore to save the file
2. uses Andy's customdataimport plugin to do the import.

Which script should I use the code in?
Quote Reply
Re: [Alba] charset In reply to
Where ever is the easiest place to do the substitution. I don't suppose it matters.
Quote Reply
Re: [afinlr] charset In reply to
Thanks. Doesn't seem to be working in the import script; I'll keep trying, perhaps I'm not placing the code in the right place.
Quote Reply
Re: [Alba] charset In reply to
If you pm the script I'll try to help.
Quote Reply
Re: [afinlr] charset In reply to
Done, thanks.