[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] s/[^ -~]//g; strikes again



Yet again this morning a program was choking on "binary characters",
this time in a Spanish address field that our XML library doesn't handle
gracefully by default. 

Once again instead of actually making a system smart enough to handle
Unicode I opted instead to just whack any characters that aren't in
SPACE (" ") through TILDE ("~") in the ASCII chart.

$conv_xml =~ s/[^ -~]//g;

Works like a dream. I live in the rural midwest, USA; why would I care
about anything not in that range in the good-ole' ASCII table? :)

Just curious: Does anyone on the list explicitly process Unicode w/
Perl? I think we've had some stuff that just magically works without us
understanding it, but it's 2007 and I still have never explicitly
handled such things. :)

j
lives a sheltered life