On 5月19日, 上午2时20分, Kristina Chodorow <
krist...@10gen.com> wrote:
> The problem is that, if you turn off the UTF8 flag, string functions (like
> getting the length) will return the wrong value.
I see, cause it will return bytes length because it in Perl internal
form.
I don't care it, anytime you should decoding it to get utf8 length.
If turn on utf8 flag, hard to display UTF-X sequence in right way,
I'm tied to applied
utf8_encoding to every rows fetched from mongoDB or
binmode(STDIN ...), sometime STDIN or STDOUT will redirect or reopen,
like template rendering.
Many templates (like TT) can't render template in utf8 flag turn-on,
because We save template in utf8 encoding, but Perl read it in Perl
internal form(byte string),
So, when it mixed with MongoDB result, will warn: ' wide character
print" , and display
template file as fuzzy , but mongoDB result correctly.
I spent a whole day to fight this problem, and found ,If I keep
mongoDB, I should modified
many framework, like Dancer, Catalyst... So, finally, I just hack
mongoDB.
I'd played with MySQL(data also stored in utf8 encoding) before, but
not any problem.
Maybe there's some wrong in my way, I'm pleased to listen anymore
advice.
nightsailer.
2010. 5. 19
>
>
>
>
>
> On Tue, May 18, 2010 at 10:41 AM, nightsailer <
nightsai...@gmail.com> wrote:
> > In perl driver, BSON string value will auto turn-on utf8 flag,
> > but this is hard to display in page, html, or template.
>
> > I must turn of utf8 flag like:
>
> > utf8_encode($content) ;
>
> > or
>
> > binmode(STDOUT, ':encoding(utf8)');
>
> > the secondary seems dirty quick, but It's hard to work with many web
> > framework,
> > like Dancer, PSGI compatible framework.
>
> > So, my hack way is just turn-off the utf8 in perl_mongo.c:
>
> > value = newSVpvn(buf->pos, len-1);
> > // SvUTF8_on(value);
>
> > I wonder, is this will raise any issues? or just work?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > To post to this group, send email to
mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
mongodb-user...@googlegroups.com<mongodb-user%2Bunsubscribe@google
groups.com>
> > .
> For more options, visit this group athttp://
groups.google.com/group/mongodb-user?hl=en.