透過 imapsync 移轉 Mail Server 過程, 發現一些使用中文所建立的目錄無法成功移轉, 又不好比對出是那些目錄, 所以找了一下可以如何將編碼轉回的方式.
: : Homepage: http://imapsync.lamiral.info/ ++++ Listing 2 errors encountered during the sync ( avoid this listing with --noerrorsdump ). Err 1/2: Could not create folder [from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.] from [from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.]: 38252 NO [CANNOT] Character not allowed in mailbox name: '.' (0.001 + 0.000 secs). Err 2/2: Could not create folder [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest] from [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest]: 38949 NO [CANNOT] Character not allowed in mailbox name: '.' (0.001 + 0.000 secs). Exiting with return value 111 Log file is LOG_imapsync/2018_08_26_16_21_49_try.txt ( to change it, use --logfile filepath ; or use --nolog to turn off logging )
yum install https://www.rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/perl-Unicode-IMAPUtf7-2.00-1.el6.rf.noarch.rpm
#!/usr/bin/perl use Unicode::IMAPUtf7; my $IMAPUtf7 = Unicode::IMAPUtf7->new(); $encode = '[from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.] [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest]'; $decode = $IMAPUtf7->decode($encode); print("[$decode]\n");
root@ct-centos6 ~]# perl test.pl [[from ABC/新客戶-DATA/INDIA/JonathanTest.] [from ABC/新客戶-DATA/Vietnam/TrysoftTest]] [root@ct-centos6 ~]#
如果對 perl 語法想快速了解, 可以參考以下網址 1)