Replace UTF-8 characters with shell perl
Clash Royale CLAN TAG#URR8PPP
up vote
6
down vote
favorite
How do I get perl
to properly replace UTF-8 character from a shell?
The examples use stdin, but I need something that works for perl ... file
too.
This is what I expect:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABC[æ][ø][ÃÂ¥]DEF
This is what I get:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABCæøÃÂ¥DEF
Replacing the Unicode characters with ASCII works instantly:
$ echo ABC123DEF | perl -CS -pe "s/([123])/[\1]/g"
ABC[1][2][3]DEF
My environment:
perl 5.18.2
Bash 3.2.57
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
perl unicode
add a comment |Â
up vote
6
down vote
favorite
How do I get perl
to properly replace UTF-8 character from a shell?
The examples use stdin, but I need something that works for perl ... file
too.
This is what I expect:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABC[æ][ø][ÃÂ¥]DEF
This is what I get:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABCæøÃÂ¥DEF
Replacing the Unicode characters with ASCII works instantly:
$ echo ABC123DEF | perl -CS -pe "s/([123])/[\1]/g"
ABC[1][2][3]DEF
My environment:
perl 5.18.2
Bash 3.2.57
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
perl unicode
add a comment |Â
up vote
6
down vote
favorite
up vote
6
down vote
favorite
How do I get perl
to properly replace UTF-8 character from a shell?
The examples use stdin, but I need something that works for perl ... file
too.
This is what I expect:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABC[æ][ø][ÃÂ¥]DEF
This is what I get:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABCæøÃÂ¥DEF
Replacing the Unicode characters with ASCII works instantly:
$ echo ABC123DEF | perl -CS -pe "s/([123])/[\1]/g"
ABC[1][2][3]DEF
My environment:
perl 5.18.2
Bash 3.2.57
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
perl unicode
How do I get perl
to properly replace UTF-8 character from a shell?
The examples use stdin, but I need something that works for perl ... file
too.
This is what I expect:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABC[æ][ø][ÃÂ¥]DEF
This is what I get:
$ echo ABCæøÃÂ¥DEF | perl -CS -pe "s/([æøÃÂ¥])/[\1]/g"
ABCæøÃÂ¥DEF
Replacing the Unicode characters with ASCII works instantly:
$ echo ABC123DEF | perl -CS -pe "s/([123])/[\1]/g"
ABC[1][2][3]DEF
My environment:
perl 5.18.2
Bash 3.2.57
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
perl unicode
edited Apr 2 at 19:49
asked Apr 2 at 12:27
forthrin
800821
800821
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
6
down vote
accepted
Use this :
$ echo 'ABCæøÃÂ¥DEF' |
perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
Works also for files
Output :
ABC[æ][ø][ÃÂ¥]DEF
Note :
- substitutions:
\1
is for awk,1
is for sed and in perl we use$1
- check
perldoc perlrun
for-CSD
utf8 tricks
Very nice! I know you can doexport PERL_UNICODE=S
to avoid-CS
. Is there a similar thing you can do to avoid-Mutf8
?alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.
â forthrin
Apr 2 at 13:39
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
1
Instead ofperl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why notperl -CSD
?
â haukex
Apr 2 at 17:45
2
@forthrin Re "perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.
â haukex
Apr 2 at 17:45
1
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
 |Â
show 3 more comments
up vote
1
down vote
Your input:
$ cat input.txt
ABCæøÃÂ¥DEF
$ hexdump -C input.txt
00000000 41 42 43 c3 a6 c3 b8 c3 a5 44 45 46 0a |ABC......DEF.|
0000000d
One good way IMO is the -C
option plus utf8
:
$ perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
If you don't want to use UTF-8 on the command line, you can always write your Perl code in plain ASCII and use escapes such as xAB
, xABCD
, or in newer Perls NU+ABCD
or NCHARNAME
:
$ perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
This one is getting a little creative: @ARGV
will be interpreted as UTF-8, so you can keep your source code as ASCII and pass the UTF-8 characters via a command line argument (not necessarily the nicest solution, just showing how you could make use of the the -CA
option):
$ perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]'
ABC[æ][ø][ÃÂ¥]DEF
Or, of course you can always turn the oneliner into an actual script, where you can
use warnings;
use 5.012;
use utf8;
use open qw/:std :encoding(UTF-8)/;
use charnames qw/:full :short/;
Further reading: perlunitut, perlunifaq, perluniintro, perlunicode, perlunicook.
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
add a comment |Â
up vote
-2
down vote
$ echo 'ABCæøÃÂ¥DEF' |
perl -CS -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
Use this :
$ echo 'ABCæøÃÂ¥DEF' |
perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
Works also for files
Output :
ABC[æ][ø][ÃÂ¥]DEF
Note :
- substitutions:
\1
is for awk,1
is for sed and in perl we use$1
- check
perldoc perlrun
for-CSD
utf8 tricks
Very nice! I know you can doexport PERL_UNICODE=S
to avoid-CS
. Is there a similar thing you can do to avoid-Mutf8
?alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.
â forthrin
Apr 2 at 13:39
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
1
Instead ofperl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why notperl -CSD
?
â haukex
Apr 2 at 17:45
2
@forthrin Re "perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.
â haukex
Apr 2 at 17:45
1
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
 |Â
show 3 more comments
up vote
6
down vote
accepted
Use this :
$ echo 'ABCæøÃÂ¥DEF' |
perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
Works also for files
Output :
ABC[æ][ø][ÃÂ¥]DEF
Note :
- substitutions:
\1
is for awk,1
is for sed and in perl we use$1
- check
perldoc perlrun
for-CSD
utf8 tricks
Very nice! I know you can doexport PERL_UNICODE=S
to avoid-CS
. Is there a similar thing you can do to avoid-Mutf8
?alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.
â forthrin
Apr 2 at 13:39
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
1
Instead ofperl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why notperl -CSD
?
â haukex
Apr 2 at 17:45
2
@forthrin Re "perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.
â haukex
Apr 2 at 17:45
1
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
 |Â
show 3 more comments
up vote
6
down vote
accepted
up vote
6
down vote
accepted
Use this :
$ echo 'ABCæøÃÂ¥DEF' |
perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
Works also for files
Output :
ABC[æ][ø][ÃÂ¥]DEF
Note :
- substitutions:
\1
is for awk,1
is for sed and in perl we use$1
- check
perldoc perlrun
for-CSD
utf8 tricks
Use this :
$ echo 'ABCæøÃÂ¥DEF' |
perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
Works also for files
Output :
ABC[æ][ø][ÃÂ¥]DEF
Note :
- substitutions:
\1
is for awk,1
is for sed and in perl we use$1
- check
perldoc perlrun
for-CSD
utf8 tricks
edited Apr 5 at 21:59
answered Apr 2 at 12:54
Gilles Quenot
15.3k13448
15.3k13448
Very nice! I know you can doexport PERL_UNICODE=S
to avoid-CS
. Is there a similar thing you can do to avoid-Mutf8
?alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.
â forthrin
Apr 2 at 13:39
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
1
Instead ofperl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why notperl -CSD
?
â haukex
Apr 2 at 17:45
2
@forthrin Re "perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.
â haukex
Apr 2 at 17:45
1
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
 |Â
show 3 more comments
Very nice! I know you can doexport PERL_UNICODE=S
to avoid-CS
. Is there a similar thing you can do to avoid-Mutf8
?alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.
â forthrin
Apr 2 at 13:39
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
1
Instead ofperl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why notperl -CSD
?
â haukex
Apr 2 at 17:45
2
@forthrin Re "perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.
â haukex
Apr 2 at 17:45
1
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
Very nice! I know you can do
export PERL_UNICODE=S
to avoid -CS
. Is there a similar thing you can do to avoid -Mutf8
? alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.â forthrin
Apr 2 at 13:39
Very nice! I know you can do
export PERL_UNICODE=S
to avoid -CS
. Is there a similar thing you can do to avoid -Mutf8
? alias perl="/usr/bin/perl -Mutf8"
if nothing else? I always use UTF-8.â forthrin
Apr 2 at 13:39
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
Please read this authoritative post stackoverflow.com/questions/6162484/â¦
â Gilles Quenot
Apr 2 at 13:43
1
1
Instead of
perl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why not perl -CSD
?â haukex
Apr 2 at 17:45
Instead of
perl -CS -Mopen=":std,IN,:encoding(utf-8)"
, why not perl -CSD
?â haukex
Apr 2 at 17:45
2
2
@forthrin Re "
perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.â haukex
Apr 2 at 17:45
@forthrin Re "
perl
is not meant for Unicode." Perl has excellent Unicode support, but for backwards compatibility it is not enabled by default, including for oneliners. If all you use Perl for is oneliners, then yes, you may have to jump through some hoops, but if you write scripts, then you'll have an easier time.â haukex
Apr 2 at 17:45
1
1
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
What I need is a string replacement tool on the command line, because this is something I do very often. I can confirm that your suggestion works for both stdin and files. I really appreciate the help.
â forthrin
Apr 3 at 5:42
 |Â
show 3 more comments
up vote
1
down vote
Your input:
$ cat input.txt
ABCæøÃÂ¥DEF
$ hexdump -C input.txt
00000000 41 42 43 c3 a6 c3 b8 c3 a5 44 45 46 0a |ABC......DEF.|
0000000d
One good way IMO is the -C
option plus utf8
:
$ perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
If you don't want to use UTF-8 on the command line, you can always write your Perl code in plain ASCII and use escapes such as xAB
, xABCD
, or in newer Perls NU+ABCD
or NCHARNAME
:
$ perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
This one is getting a little creative: @ARGV
will be interpreted as UTF-8, so you can keep your source code as ASCII and pass the UTF-8 characters via a command line argument (not necessarily the nicest solution, just showing how you could make use of the the -CA
option):
$ perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]'
ABC[æ][ø][ÃÂ¥]DEF
Or, of course you can always turn the oneliner into an actual script, where you can
use warnings;
use 5.012;
use utf8;
use open qw/:std :encoding(UTF-8)/;
use charnames qw/:full :short/;
Further reading: perlunitut, perlunifaq, perluniintro, perlunicode, perlunicook.
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
add a comment |Â
up vote
1
down vote
Your input:
$ cat input.txt
ABCæøÃÂ¥DEF
$ hexdump -C input.txt
00000000 41 42 43 c3 a6 c3 b8 c3 a5 44 45 46 0a |ABC......DEF.|
0000000d
One good way IMO is the -C
option plus utf8
:
$ perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
If you don't want to use UTF-8 on the command line, you can always write your Perl code in plain ASCII and use escapes such as xAB
, xABCD
, or in newer Perls NU+ABCD
or NCHARNAME
:
$ perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
This one is getting a little creative: @ARGV
will be interpreted as UTF-8, so you can keep your source code as ASCII and pass the UTF-8 characters via a command line argument (not necessarily the nicest solution, just showing how you could make use of the the -CA
option):
$ perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]'
ABC[æ][ø][ÃÂ¥]DEF
Or, of course you can always turn the oneliner into an actual script, where you can
use warnings;
use 5.012;
use utf8;
use open qw/:std :encoding(UTF-8)/;
use charnames qw/:full :short/;
Further reading: perlunitut, perlunifaq, perluniintro, perlunicode, perlunicook.
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Your input:
$ cat input.txt
ABCæøÃÂ¥DEF
$ hexdump -C input.txt
00000000 41 42 43 c3 a6 c3 b8 c3 a5 44 45 46 0a |ABC......DEF.|
0000000d
One good way IMO is the -C
option plus utf8
:
$ perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
If you don't want to use UTF-8 on the command line, you can always write your Perl code in plain ASCII and use escapes such as xAB
, xABCD
, or in newer Perls NU+ABCD
or NCHARNAME
:
$ perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
This one is getting a little creative: @ARGV
will be interpreted as UTF-8, so you can keep your source code as ASCII and pass the UTF-8 characters via a command line argument (not necessarily the nicest solution, just showing how you could make use of the the -CA
option):
$ perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]'
ABC[æ][ø][ÃÂ¥]DEF
Or, of course you can always turn the oneliner into an actual script, where you can
use warnings;
use 5.012;
use utf8;
use open qw/:std :encoding(UTF-8)/;
use charnames qw/:full :short/;
Further reading: perlunitut, perlunifaq, perluniintro, perlunicode, perlunicook.
Your input:
$ cat input.txt
ABCæøÃÂ¥DEF
$ hexdump -C input.txt
00000000 41 42 43 c3 a6 c3 b8 c3 a5 44 45 46 0a |ABC......DEF.|
0000000d
One good way IMO is the -C
option plus utf8
:
$ perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
If you don't want to use UTF-8 on the command line, you can always write your Perl code in plain ASCII and use escapes such as xAB
, xABCD
, or in newer Perls NU+ABCD
or NCHARNAME
:
$ perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSD -pe 's/([xE6xF8xE5])/[$1]/g'
ABC[æ][ø][ÃÂ¥]DEF
This one is getting a little creative: @ARGV
will be interpreted as UTF-8, so you can keep your source code as ASCII and pass the UTF-8 characters via a command line argument (not necessarily the nicest solution, just showing how you could make use of the the -CA
option):
$ perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]' input.txt
ABC[æ][ø][ÃÂ¥]DEF
$ cat input.txt | perl -CSDA -pe 'BEGIN$p=shift; s/($p)/[$1]/g' '[æøÃÂ¥]'
ABC[æ][ø][ÃÂ¥]DEF
Or, of course you can always turn the oneliner into an actual script, where you can
use warnings;
use 5.012;
use utf8;
use open qw/:std :encoding(UTF-8)/;
use charnames qw/:full :short/;
Further reading: perlunitut, perlunifaq, perluniintro, perlunicode, perlunicook.
answered Apr 2 at 18:21
haukex
2839
2839
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
add a comment |Â
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
Appreciate the information about the alternative character syntaxes.
â forthrin
Apr 3 at 5:43
add a comment |Â
up vote
-2
down vote
$ echo 'ABCæøÃÂ¥DEF' |
perl -CS -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
add a comment |Â
up vote
-2
down vote
$ echo 'ABCæøÃÂ¥DEF' |
perl -CS -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
add a comment |Â
up vote
-2
down vote
up vote
-2
down vote
$ echo 'ABCæøÃÂ¥DEF' |
perl -CS -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
$ echo 'ABCæøÃÂ¥DEF' |
perl -CS -Mutf8 -pe 's/([æøÃÂ¥])/[$1]/g'
answered Apr 2 at 18:26
Porno Nacionais
11
11
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435043%2freplace-utf-8-characters-with-shell-perl%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password