| | |
| | | ], |
| | | icann_addr = 'mailtest\\x40('+icann_domains.join('|')+')', |
| | | word = '('+atom+'|'+quoted_string+')', |
| | | delim = '[,;\s\n]', |
| | | delim = '[,;\\s\\n]', |
| | | local_part = word+'(\\x2e'+word+')*', |
| | | addr_spec = '(('+local_part+'\\x40'+domain+')|('+icann_addr+'))', |
| | | reg1 = inline ? new RegExp('(^|<|'+delim+')'+addr_spec+'($|>|'+delim+')', 'i') : new RegExp('^'+addr_spec+'$', 'i'); |
| | |
| | | * @param {String} input The string to encode in base64. |
| | | */ |
| | | encode: function (input) { |
| | | // encode UTF8 as btoa() may fail on some characters |
| | | input = utf8_encode(input); |
| | | |
| | | if (typeof(window.btoa) === 'function') { |
| | | // it may fail on unicode characters, the fallback can handle them |
| | | try { |
| | | return btoa(input); |
| | | } |
| | | catch (e) {}; |
| | | } |
| | | |
| | | input = utf8_encode(input); |
| | | |
| | | var chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0, output = '', len = input.length; |
| | | |
| | |
| | | */ |
| | | decode: function (input) { |
| | | if (typeof(window.atob) === 'function') { |
| | | // it may fail on unicode characters, the fallback can handle them |
| | | try { |
| | | return utf8_decode(atob(input)); |
| | | } |