in reply to Re: sring encode problem (hexadecimal)
in thread sring encode problem (hexadecimal)

Hi JavaFan


It seems it is non working. i wil return a blank (nothing return)
#!/usr/bin/perl $string="€"; $string = s/([^\x00-\xFF])/sprintf "&#x%x;", $1/eg; # Encode print $string;


Anyway thanks for the reply Have a nice day







Replies are listed 'Best First'.
Re^3: sring encode problem (hexadecimal)
by JavaFan (Canon) on Jan 19, 2011 at 11:46 UTC
    Use a bind operator (=~) instead of an assignment operator (=).
      Thanks for the enlightment.
      Use a bind operator (=~) instead of an assignment operator (=).

      now it seems print out a utf-8 encoded string.
      while it is not 7 digit in the format of "& #x20AC;" (which is 7 digit)


      Thanks again
        What's the encoding of the source file? By not saying otherwise, you've communicated that it's iso-8859-1. Add use utf8; if it's encoded using UTF-8.