Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: How to remove wide chars (ex: 年 or 或) from a text file?

by graff (Chancellor)
on Mar 06, 2013 at 02:54 UTC ( #1021935=note: print w/replies, xml ) Need Help??


in reply to How to remove wide chars (ex: 年 or &#x6216) from a text file?

I agree with davido - your question is too vague. What I see in the OP are hexadecimal entity references for Chinese characters. Maybe you have entity references to other non-ASCII characters as well? If you just want to delete all such entity references:
s/\&#x\w+;//g;
(Note that the number of hex digits per character may vary.) In the case of the OP data sample, that regex leaves 7 lines that are either empty or contain just hyphens and/or spaces.
  • Comment on Re: How to remove wide chars (ex: 年 or &#x6216) from a text file?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021935]
help
Chatterbox?
[Corion]: GotToBTru: Yeah, that stuff is hard to do away automatically ;)
[GotToBTru]: yeah, you mentioned it could not handle signatures
[Corion]: And so far I like signatures and nobody has yet come up to me and screamed at me for implementing a source filter to handle them even on early Perl versions ;)
[Corion]: I should re-prod tsee about the Filter::Simple branches that he might want to merge or that I should merge so he can do a release ;-D

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (14)
As of 2017-02-27 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (387 votes). Check out past polls.