in reply to
Re: Unicode substitution regex conundrum
in thread Unicode substitution regex conundrum
Thank you for the helpful responses. I learned several new things. However, I am still unable to get my program functioning correctly.
For starters, I am not opening a file. I am receiving the utf8 input from an HTML form, and, quite frankly, I have no way of knowing whether user input will be received in the Perl script as utf8, unicode, big5, gb2312, etc., although I am trying to work solely with utf8. The database being searched is in utf8, but Perl is doing next to nothing with it once received with the DBI commands, other than outputting it back to HTML.
On your advice, I tried learning more about utf8, and have tried using the -COE command in the shebang line (this rendered the output unreadable), and I tried using the Encode qw(encode decode), to no avail.
Here are my current uses:
use CGI::Carp qw(fatalsToBrowser);
use Encode qw(_utf8_on);
use Encode::HanConvert; #Module for dealing with CJK conversions
use Encode qw(encode decode);
So I am still left wondering how to make perl see the string as utf8. Am I missing something? Is Perl 5.8.7 recent enough? How can I flag utf8 on input from a form rather than a file?
The real puzzle, to me, is that split// seems to work, but the s/// won't work. Unfortunately, I have no way of knowing how many terms the user will be entering, so using split would require some significant recoding.