in reply to qq sql - umlaut isssue

What character set is your Perl script saved in?

The best idea is to make sure you're using UTF-8 everywhere. Instruct your text editor to save your Perl script in UTF-8 (and make sure you include the line use utf8; in the script to inform Perl that it's in UTF-8!); make sure your database is set up to accept UTF-8 data; make sure DBI is configured correctly to transmit UTF-8.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: qq sql - umlaut isssue
by Anonymous Monk on Jul 30, 2012 at 09:02 UTC

    UTF8 format is used already and this is not a problem. the problem is as described below

    In the below SQL when i use the table name ($updatetable)as variable inside 'qq' for update it is displaying junk.

    push @arraysql, qq{ UPDATE $updatetable a SET sometext = 'üseable term' where .... };

    however when i use the table name direclty inside 'qq' the umlaut character is updated correctly.

    push @arraysql, qq{ UPDATE user.updatetable a SET sometext = 'üseable term' where .... };

      UTF8 format is used already

      But is it used everywhere as I suggested?

      I concur with the anonymous monk above that $updatetable is probably not a utf8 character string, but a byte string. Where has that variable come from? Was it read from a file? If so, have you checked that the file was opened in utf8 mode?

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      I have a hunch. This is Perl's Unicode support messing it up. Perl says $updatetable is a character string (i.e. Unicode), and your string literal is a byte string (or vice versa), and when you try to combine them, Perl tries to upgrade both to character strings. How do you set $updatetable? Are you using the use utf8; pragma?

      If you are pushing a variable as a quoted character into an array, how does the variable get replaced with the actual value?