mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-08 05:34:30 +02:00
1.670
This commit is contained in:
parent
f1987d5e52
commit
b7c835d670
134 changed files with 44448 additions and 2810 deletions
23
W/learn/imap_utf7_encode
Executable file
23
W/learn/imap_utf7_encode
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Unicode::String ;
|
||||
|
||||
while (<>) {
|
||||
chomp ;
|
||||
push( @result, sprintf( "%s\n", imap_utf7_encode( $_ ) ) ) ;
|
||||
}
|
||||
|
||||
print @result ;
|
||||
|
||||
# http://cpansearch.perl.org/src/FABPOT/Unicode-IMAPUtf7-2.01/lib/Unicode/IMAPUtf7.pm
|
||||
|
||||
sub imap_utf7_encode {
|
||||
my ( $s ) = @_ ;
|
||||
|
||||
$s = Unicode::String::utf8( $s )->utf7 ;
|
||||
|
||||
$s =~ s/\+([^\/&\-]*)\/([^\/\-&]*)\-/\+$1,$2\-/g ;
|
||||
$s =~ s/&/&\-/g ;
|
||||
$s =~ s/\+([^+\-]+)?\-/&$1\-/g ;
|
||||
return( $s ) ;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue