in reply to Remove u200b unicode From String

If the string really does contain the character 0x200B, you can use any of the following:

s/\x{200B}//g s/\N{U+200B}//g s/\N{ZERO WIDTH SPACE}//g

The last may require use charnames qw( :full );.

Replies are listed 'Best First'.
Re^2: Remove u200b unicode From String
by phildeman (Scribe) on Jul 25, 2024 at 03:50 UTC

    Thanks for your suggestions. Unfortunately, none of the suggestions worked. I still get the Sustainable B?usiness?.

    -Phil-
      Did you see my comment about the string needing to be recognized as Unicode by perl? If perl is seeing utf8 bytes, it can't match a unicode character.

      Try printing this:

      use B; say B::perlstring($myvalue);

      So you don't have character 0x200B. What do you have? You can use sprintf "%vX", $str for that.

      Just wild guess, but if your data has line breaks then you might try adding the /m modifier to the substitution.

      s/\x{200B}//gm