http://www.perlmonks.org?node_id=921447


in reply to Re^3: HTML::Entities and Unicode quotes
in thread HTML::Entities and Unicode quotes

You know exactly what you’re doing but someone who doesn’t sees a top monk using it they think, oh, that must be a good idea

You're making my point for me. is_utf8 should never ever ever ever be used. So what are you doing using it, especially to someone who think it might be ok to use it?

You artificially flipped the switch on/off—no decoding or encoding.

No, I didn't. The UTF8 flag does not indicate any such thing.

Not only are you showing a function you shouldn't be using, you're showing how to use it incorrectly.

You also showed code using the functions of utf8 which is probably a bad example to set.

There's nothing wrong with the utf8:: module. There's something wrong with the is_utf8 function, though. is_utf8 should never ever ever ever be used.

On the other hand, there's absolutely no problem using ugprade and downgrade. First, they're not suppose to have any effect whatsoever. Secondly, they are required to work around bugs in Perl and XS modules.

You're the one setting the bad example. I just had to use advanced functions to show that.

they think, oh, that must be a good idea, I’ll use upgrade and downgrade to “fix” my encodings too.

Good! You seem to be implying that's bad, but if upgrade or downgrade have an effect, they are the correct tool to use. They'll only do a difference when faced with a bug, and they're the only tool that will help in that situation.

Replies are listed 'Best First'.
Re^5: HTML::Entities and Unicode quotes
by Your Mother (Archbishop) on Aug 20, 2011 at 22:48 UTC

    Excepting the demonstration of what perl believed the strings to be, my answer’s code content was essentially identical to yours.

    The Re^15-deep feuds about this sort of thing in the past are suddenly less mysterious.

      I agree. Except for not misusing is_utf8, my solution is quite similar to yours.

      I didn't say your solution was wrong, I said your use of is_utf8 was wrong.

      • It doesn't do what you purport it does.
      • It shouldn't be used at all.
      • Especially not when introducing someone to encodings.