Gossamer Forum
Quote Reply
convert charset
Is there a global that can convert windows-1255 to utf-8
Quote Reply
Re: [nir] convert charset In reply to
Untested - but try:

convert_to_utf8
Code:
sub {

use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset);

my $val = $_[0];
if ($val =~ /[\200-\377]/) {
$val =~ s/([\200-\377]+)/from_utf8({ -string => $1, -charset => 'ISO-8859-1'})/eg;
}

return $val;

}

..call with:

<%convert_to_utf8($Description)%>

(you may have to play around with the ISO-8859-1 bit, to fit your needs - as this is from my DMOZ_Wizard plugin)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Apr 27, 2009, 7:51 AM
Quote Reply
Re: [Andy] convert charset In reply to
Thanks
What I need to install on the server so the MapUTF8 will work.
Quote Reply
Re: [nir] convert charset In reply to
You need to instal Unicode::MapUTF8

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] convert charset In reply to
I get this error
Global symbol "$val" requires explicit package name at (eval 34) line
I insert my $val; but than I didn’t get anything at all
Quote Reply
Re: [nir] convert charset In reply to
Sorry, my fault - please try the edited version above.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] convert charset In reply to
Thanks Again,
It don’t convert the windows-1255 to UTF-8, it just get something like this
10% , , , . . , , . " - , - 2.5 . , 2,500 . 30% , 25% 6 , 25% 12 20% . , 70% . , , , " . , 3.5 35 . ,


Do you have and idea
Quote Reply
Re: [nir] convert charset In reply to
Sorry - really busy. Will try and have a look at it some other time :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!