Gossamer Forum
Home : General : Perl Programming :

Local coding question

Quote Reply
Local coding question
Dear all,

I have script which has a line in their code :

$$fields =~ s/\'/\"/g;

but I know this line can't correctly record some of the Chinese characters. For example, I can't record the following word "‹–".

Can anyone tell me how to change the above line in order to correctly record the Chinese Characters or the word "‹–" ?

Thanks in advanced.



Quote Reply
Re: Local coding question In reply to
To echo my post on Hotscripts forum, please clarify what you mean by "record" a character.

--mark

Installation support is provided via ICQ at UIN# 53788453. I will only respond on that number.
Quote Reply
Re: Local coding question In reply to
Hi Mark Badolato,

I am sorry that I am not a programmer. I just know that script record the database from a form into the mysql database. Here is that section of the script:

else
{
$$fields = $deger->param($fields);
$$fields =~ s/\'/\"/g;
$record = $record."\'$$fields\',";
}
}
chop ($record) if ($record =~ /\,$/);

This is because if I use "s/\'/\"/g", it add some of the Chinese characters into the mysql database incorrectly. Because some Chinese characters might contains "/" or "\" in the characters. So I think it's the cause of the problem. So is there any code to let me replace "s/\'/\"/g" in order to add the Chinese characters into the mysql database correctly? Or is there any other code cause the problem?

Hope this explaination helps.


Quote Reply
Re: Local coding question In reply to
You should hire a programmer. You are so far off base from what that code is doing that it's impossible to help you.
The regex has nothing to do with chinese characters, it's changing any single quotes to double quotes.
Also, why are you referencing a scalar?

perldoc perlsub
perldoc perlre
hell, perldoc perldoc!

-- Gordon


s/(\d{2})/chr($1)/ge + print if $_ = '8284703280698276687967';