in reply to Re: Change encoding of a string from utf8 to iso-8859-2
in thread Change encoding of a string from utf8 to iso-8859-2

well, I do just
$ret = from_to($ret, "iso-8859-2", "utf8");
no magic. I fetch webpage, cut sime content and want to display it. but this one does not work : /

Replies are listed 'Best First'.
Re^3: Change encoding of a string from utf8 to iso-8859-2
by graff (Chancellor) on Mar 05, 2010 at 08:07 UTC
    Apart from the fact that you haven't provided sample data or enough code to demonstrate what you mean by "does not work", you either didn't read or didn't understand what the Encode man page says about the "from_to()" function: from_to() returns the length of the converted string (in octets), after doing the conversion "in-place" (i.e. replacing the original content of a string variable with the converted content).

    This one line of code you showed us is assigning the return value (length in octets) to the same variable that you are trying to convert. That obliterates whatever string you just converted, replacing it with a number.

Re^3: Change encoding of a string from utf8 to iso-8859-2
by Anonymous Monk on Mar 05, 2010 at 07:46 UTC
    ...no magic. I fetch webpage, cut sime content and want to display it. but this one does not work : /

    That is not adequate to replicate your problem. How (Not) To Ask A Question