Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: utf8 is_valid on concat

by Juerd (Abbot)
on Mar 13, 2008 at 11:57 UTC ( #673950=note: print w/ replies, xml ) Need Help??

in reply to utf8 is_valid on concat

Are you perhaps doing any of the following?

  • Using the :utf8 layer for input (open, binmode)
  • Using _utf8_on anywhere
  • Forgetting to decode input
  • Forgetting to encode output
Please describe in more detail what "trouble" is, and how you get there.

Juerd # { site => '', do_not_use => 'spamtrap', perl6_server => 'feather' }

Comment on Re: utf8 is_valid on concat
Replies are listed 'Best First'.
Re^2: utf8 is_valid on concat
by threedaygoaty (Novice) on Mar 14, 2008 at 03:53 UTC
    Thanks for this, AFAIK we are using utf8 functions correctly. However, it is very likely that somewhere in 200K lines of perl a simple string concat is happening between a UTF8 string and a non-UTF8 string. My idea is to try to trap this so we can find it. The only way I can think of doing is to overload the concat operator. I'm also keen to know if it is possible. We tried this but it does not work...
    use strict; package UNIVERSAL; use overload "." => \&concat; sub concat { my ($a, $b) = @_; return join "XXX", $a, $b; } package Foo; my $thing = "cat" . "dog"; print "\n\n\n$thing\n\n\n";
    This produces catdog

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://673950]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2015-11-27 13:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (729 votes), past polls