test code:
my $t = $mongo_dbh->get_collection('test');
my $word = '测试';
$t->insert({ title => $word });
my $row = $t->find_one();
print "title:",$row->{title}, "\n";
the output is not expect, it will output some strange fuzzy string.
and, I use mongo shell to check, the title field stored incorrectly.
It seems "double" encode, I fix the test code:
my $t = $mongo_dbh->get_collection('test');
my $word = '测试';
$t->insert({ title => decode_utf8($word) });
my $row = $t->find_one();
print "title:",$row->{title}, "\n";
now, output is right. and mongo shell is also show ok.
I think maybe perl driver should auto decode string from utf8 or
perl's internal format
into a sequence of logical characters before store it to backend db?
I've test on mongo shell, it can handle Chinese string transparent, so
I think perl should do.
also PHP driver, it works fine.
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To post to this group, send email to mongo...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-dev?hl=en.
On Dec 19, 3:24 am, Kristina Chodorow <krist...@10gen.com> wrote:
> I've pushed a fix to Github (http://github.com/mongodb/mongo-perl-driver),
> or you can wait until Tuesday (which is when I'm planning on releasing
> version .27).
>
> Sorry about that, I didn't realise the Perl function that it would double
> encode strings that already were UTF8. Now it'll only encode it if it isn't
> valid UTF8 already.
>
> 2009/12/18 nightsailer <nightsai...@gmail.com>
> > mongodb-dev...@googlegroups.com<mongodb-dev%2Bunsubscribe@googlegr oups.com>