Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: accented characters are garbled

by spspspsp (Initiate)
on Feb 18, 2013 at 07:58 UTC ( #1019291=note: print w/replies, xml ) Need Help??


in reply to Re: accented characters are garbled
in thread accented characters are garbled

Yes, it was the terminal setting. Changing vt100 to xterm shows characters fine. Now, how do I replace accented characters with ascii? E.g. to o. I tried the following, but it did not work:
$city = "Sprngfld"; use utf8; utf8::upgrade($city); utf8::encode($city); print $city;

Replies are listed 'Best First'.
Re^3: accented characters are garbled
by Anonymous Monk on Feb 18, 2013 at 08:40 UTC
Re^3: accented characters are garbled
by Anonymous Monk on Feb 18, 2013 at 11:02 UTC

    So if you got the display working, why do you now want to strip the diacritics?

    Anyway, Text::Unidecode. And while I'm at it, here's the boilerplate code for getting Perl reasonably UTF-8:

    use utf8; # upgrades your strings my $city = "Sprngfld"; binmode(STDOUT, ":encoding(utf-8)"); print $city, "\n"; # use decode_utf8() when reading from e.g. a file # alternatively, see the binmode() call above use Encode 'decode_utf8'; my $input_raw = <STDIN>; my $input = decode_utf8($input_raw); print $input, "\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019291]
help
Chatterbox?
[TCLion]: I am breaking down the line and putting the date in the correct order during output
[TCLion]: at least that's the plan
[1nickt]: Corion this looks good, from the pod: "there are 9000+ variations that are detected correctly in the test files (see t/data/* for most of them). If you can think of any that I do not cover, please let me know."
[TCLion]: some moron put the date like this : Mon Feb 20 09:31:30 2017
[Corion]: 1nickt: Yes, the module sounds promising indeed
[1nickt]: "putting the date in correct order" how?
[Corion]: TCLion: Whee ;)
[TCLion]: need to put like this : 2017-02-20 09:30:53
[1nickt]: That's why I asked if you are using DateTime. It has a large number of supporting modules (the author likes the term 'eco-system') so if you are already creating a DateTime obj from your dates, this module would read in the mnoron-formatted 1s seamlessly
[TCLion]: when I put the date together it looks like : 2017-Feb-24 (month is the problem)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (14)
As of 2017-03-23 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (288 votes). Check out past polls.