From 8c1761c64a5c6a24575f43e5afe7a1661cb7f34f Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 26 Sep 2012 18:18:20 +0000
Subject: [PATCH] Implemented:  FS#1102 - Convert internationalized domains to
 punycode automatically - need to have the pecl idn and intl modules installed
   or - have the idna_convert class in the classes/idn/ path

---
 interface/lib/classes/functions.inc.php       | 69 ++++++++++++++++++-
 interface/lib/classes/listform.inc.php        |  5 ++
 interface/lib/classes/remoting_lib.inc.php    | 12 +---
 interface/lib/classes/tform.inc.php           | 20 ++----
 .../web/admin/form/server_config.tform.php    |  7 ++
 .../web/admin/form/system_config.tform.php    | 14 ++++
 interface/web/admin/list/server.list.php      |  3 +
 interface/web/client/form/client.tform.php    |  7 ++
 interface/web/client/form/domain.tform.php    |  7 ++
 interface/web/client/form/reseller.tform.php  |  7 ++
 interface/web/client/list/domain.list.php     |  3 +
 interface/web/dns/form/dns_a.tform.php        |  7 ++
 interface/web/dns/form/dns_alias.tform.php    | 14 ++++
 interface/web/dns/form/dns_cname.tform.php    | 14 ++++
 interface/web/dns/form/dns_hinfo.tform.php    |  7 ++
 interface/web/dns/form/dns_mx.tform.php       | 14 ++++
 interface/web/dns/form/dns_ns.tform.php       | 14 ++++
 interface/web/dns/form/dns_ptr.tform.php      | 14 ++++
 interface/web/dns/form/dns_rp.tform.php       |  7 ++
 interface/web/dns/form/dns_slave.tform.php    | 14 ++++
 interface/web/dns/form/dns_soa.tform.php      | 21 ++++++
 interface/web/dns/form/dns_srv.tform.php      |  7 ++
 interface/web/dns/form/dns_txt.tform.php      |  7 ++
 interface/web/dns/list/dns_a.list.php         |  3 +
 interface/web/dns/list/dns_slave.list.php     |  6 ++
 interface/web/dns/list/dns_soa.list.php       |  9 +++
 interface/web/mail/form/mail_alias.tform.php  | 14 ++++
 .../web/mail/form/mail_aliasdomain.tform.php  | 14 ++++
 interface/web/mail/form/mail_domain.tform.php | 10 ++-
 .../mail/form/mail_domain_catchall.tform.php  | 14 ++++
 .../web/mail/form/mail_forward.tform.php      | 14 ++++
 interface/web/mail/form/mail_get.tform.php    | 14 ++++
 .../web/mail/form/mail_mailinglist.tform.php  | 14 ++++
 .../web/mail/form/mail_transport.tform.php    |  7 ++
 interface/web/mail/form/mail_user.tform.php   | 14 ++++
 .../web/mail/form/spamfilter_config.tform.php |  7 ++
 .../web/mail/form/spamfilter_users.tform.php  |  7 ++
 .../mail/form/spamfilter_whitelist.tform.php  |  7 ++
 interface/web/mail/list/mail_alias.list.php   |  6 ++
 .../web/mail/list/mail_aliasdomain.list.php   |  6 ++
 interface/web/mail/list/mail_domain.list.php  |  3 +
 .../mail/list/mail_domain_catchall.list.php   |  6 ++
 interface/web/mail/list/mail_forward.list.php |  6 ++
 interface/web/mail/list/mail_get.list.php     |  3 +
 .../web/mail/list/mail_mailinglist.list.php   |  3 +
 .../web/mail/list/mail_transport.list.php     |  3 +
 interface/web/mail/list/mail_user.list.php    |  3 +
 .../web/mail/list/mail_user_stats.list.php    |  3 +
 .../web/mail/list/user_quota_stats.list.php   |  3 +
 interface/web/mail/mail_domain_edit.php       |  2 +-
 .../web/mailuser/form/mail_user_cc.tform.php  |  7 ++
 .../web/sites/form/web_aliasdomain.tform.php  |  7 ++
 interface/web/sites/form/web_domain.tform.php | 10 ++-
 .../web/sites/form/web_subdomain.tform.php    |  7 ++
 .../sites/form/web_vhost_subdomain.tform.php  |  7 ++
 interface/web/sites/list/ftp_user.list.php    |  3 +
 interface/web/sites/list/shell_user.list.php  |  3 +
 .../web/sites/list/user_quota_stats.list.php  |  3 +
 .../web/sites/list/web_aliasdomain.list.php   |  6 ++
 interface/web/sites/list/web_domain.list.php  |  3 +
 interface/web/sites/list/web_folder.list.php  |  3 +
 .../web/sites/list/web_folder_user.list.php   |  3 +
 .../web/sites/list/web_sites_stats.list.php   |  3 +
 .../web/sites/list/web_subdomain.list.php     |  6 ++
 .../sites/list/web_vhost_subdomain.list.php   |  6 ++
 interface/web/sites/web_aliasdomain_edit.php  |  2 +-
 interface/web/sites/web_domain_edit.php       |  2 +-
 interface/web/sites/web_subdomain_edit.php    |  2 +-
 .../web/sites/web_vhost_subdomain_edit.php    |  2 +-
 interface/web/vm/form/openvz_vm.tform.php     |  7 ++
 interface/web/vm/list/openvz_vm.list.php      |  3 +
 71 files changed, 553 insertions(+), 37 deletions(-)

diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index b0e1f3b02..fcb6055c6 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -32,7 +32,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //* This class is loaded automatically by the ispconfig framework.
 
 class functions {
-	
+	var $idn_converter = null;
+    var $idn_converter_name = '';
 
 	public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'application/pdf', $filename = '', $cc = '', $bcc = '', $from_name = '') {
 		global $app,$conf;
@@ -310,6 +311,72 @@ class functions {
             return intval($string);
         }
     }
+    
+    /** IDN converter wrapper.
+     * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
+     */
+    public function idn_encode($domain) {
+        if($domain == '') return '';
+        if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
+        
+        // get domain and user part if it is an email
+        $user_part = false;
+        if(strpos($domain, '@') !== false) {
+            $user_part = substr($domain, 0, strrpos($domain, '@'));
+            $domain = substr($domain, strrpos($domain, '@') + 1);
+        }
+        
+        if(function_exists('idn_to_ascii')) {
+            $domain = idn_to_ascii($domain);
+        } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+             /* use idna class:
+             * @author  Matthias Sommerfeld <mso@phlylabs.de>
+             * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
+             * @version 0.8.0 2011-03-11
+             */
+            
+            if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+                include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
+                $this->idn_converter = new idna_convert(array('idn_version' => 2008));
+                $this->idn_converter_name = 'idna_convert.class';
+            }
+            $domain = $this->idn_converter->encode($domain);
+        }
+        
+        if($user_part !== false) return $user_part . '@' . $domain;
+        else return $domain;
+    }
+    
+    public function idn_decode($domain) {
+        if($domain == '') return '';
+        if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee decoded
+        
+        // get domain and user part if it is an email
+        $user_part = false;
+        if(strpos($domain, '@') !== false) {
+            $user_part = substr($domain, 0, strrpos($domain, '@'));
+            $domain = substr($domain, strrpos($domain, '@') + 1);
+        }
+        if(function_exists('idn_to_utf8')) {
+            $domain = idn_to_utf8($domain);
+        } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+             /* use idna class:
+             * @author  Matthias Sommerfeld <mso@phlylabs.de>
+             * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
+             * @version 0.8.0 2011-03-11
+             */
+            
+            if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+                include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
+                $this->idn_converter = new idna_convert(array('idn_version' => 2008));
+                $this->idn_converter_name = 'idna_convert.class';
+            }
+            $domain = $this->idn_converter->decode($domain);
+        }
+        
+        if($user_part !== false) return $user_part . '@' . $domain;
+        else return $domain;
+    }
 		
 }
 
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index 4b6b7c1a0..6128022ac 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -291,6 +291,11 @@ class listform {
         if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
             foreach($this->listDef['item'] as $field){
                 $key = $field['field'];
+                //* Apply filter to record value.
+                if(isset($field['filters']) && is_array($field['filters'])) {
+                    $app->uses('tform');
+                    $record[$key] = $app->tform->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
+                }
 				if(isset($record[$key])) {
                 	switch ($field['datatype']){
                     case 'VARCHAR':
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 67ad85592..40db6e072 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -418,18 +418,10 @@ class remoting_lib {
 							$returnval = strtoupper($field_value);
 						break;
 						case 'IDNTOASCII':
-							if(function_exists('idn_to_ascii')) {
-								$returnval = idn_to_ascii($field_value);
-							} else {
-								$returnval = $field_value;
-							}
+							$returnval = $app->functions->idn_encode($field_value);
 						break;
 						case 'IDNTOUTF8':
-							if(function_exists('idn_to_utf8')) {
-								$returnval = idn_to_utf8($field_value);
-							} else {
-								$returnval = $field_value;
-							}
+							$returnval = $app->functions->idn_decode($field_value);
 						break;
 						default:
 							$this->errorMessage .= "Unknown Filter: ".$filter['type'];
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index cfb04b416..b6cc343e6 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -629,7 +629,6 @@ class tform {
                                 if(isset($field['filters']) && is_array($field['filters'])) {
 									$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
 								}
-								
 								//* Validate record value
 								if(isset($field['validators']) && is_array($field['validators'])) {
 									$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
@@ -738,24 +737,16 @@ class tform {
 				if($filter['event'] == $filter_event) {
 					switch ($filter['type']) {
 						case 'TOLOWER':
-							$returnval = strtolower($field_value);
+							$returnval = strtolower($returnval);
 						break;
 						case 'TOUPPER':
-							$returnval = strtoupper($field_value);
+							$returnval = strtoupper($returnval);
 						break;
 						case 'IDNTOASCII':
-							if(function_exists('idn_to_ascii')) {
-								$returnval = idn_to_ascii($field_value);
-							} else {
-								$returnval = $field_value;
-							}
+							$returnval = $app->functions->idn_encode($returnval);
 						break;
 						case 'IDNTOUTF8':
-							if(function_exists('idn_to_utf8')) {
-								$returnval = idn_to_utf8($field_value);
-							} else {
-								$returnval = $field_value;
-							}
+							$returnval = $app->functions->idn_decode($returnval);
 						break;
 						default:
 							$this->errorMessage .= "Unknown Filter: ".$filter['type'];
@@ -763,8 +754,7 @@ class tform {
 					}
 				}
 			}
-
-			return $returnval;
+            return $returnval;
         }
 
         /**
diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php
index 2cf2170ec..b16b5928e 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -109,6 +109,13 @@ $form["tabs"]['server'] = array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => 'server1.domain.tld',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators' => array(0 => array('type' => 'NOTEMPTY',
 					'errmsg' => 'hostname_error_empty'),
 			),
diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php
index 370e57f60..7020ee2b1 100644
--- a/interface/web/admin/form/system_config.tform.php
+++ b/interface/web/admin/form/system_config.tform.php
@@ -212,6 +212,13 @@ $form["tabs"]['mail'] = array (
 		),
 		'admin_mail' => array (
 			'datatype'	=> 'VARCHAR',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'formtype'	=> 'TEXT',
 			'default'	=> '',
 			'value'		=> '',
@@ -234,6 +241,13 @@ $form["tabs"]['mail'] = array (
 		),
 		'smtp_host' => array (
 			'datatype'	=> 'VARCHAR',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'formtype'	=> 'TEXT',
 			'default'	=> '',
 			'value'		=> '',
diff --git a/interface/web/admin/list/server.list.php b/interface/web/admin/list/server.list.php
index 2d98c1f0d..acca81a92 100644
--- a/interface/web/admin/list/server.list.php
+++ b/interface/web/admin/list/server.list.php
@@ -46,6 +46,9 @@ $liste['auth']				= 'yes';
 
 $liste['item'][] = array(	'field'		=> 'server_name',
 							'datatype'	=> 'VARCHAR',
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> 'TEXT',
 							'op'		=> 'like',
 							'prefix'	=> '%',
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index 20c46c2b6..4faaa6d36 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -285,6 +285,13 @@ $form["tabs"]['address'] = array (
 		'email' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'value'		=> '',
 			'separator'	=> '',
diff --git a/interface/web/client/form/domain.tform.php b/interface/web/client/form/domain.tform.php
index 2617fc23b..40f9a90a8 100644
--- a/interface/web/client/form/domain.tform.php
+++ b/interface/web/client/form/domain.tform.php
@@ -88,6 +88,13 @@ $form["tabs"]['domain'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'domain_error_empty'),
 										1 => array (	'type'	=> 'UNIQUE',
diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php
index f437b2e92..1669e36bf 100644
--- a/interface/web/client/form/reseller.tform.php
+++ b/interface/web/client/form/reseller.tform.php
@@ -286,6 +286,13 @@ $form["tabs"]['address'] = array (
 		'email' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'value'		=> '',
 			'separator'	=> '',
diff --git a/interface/web/client/list/domain.list.php b/interface/web/client/list/domain.list.php
index e9630e388..a7534a228 100644
--- a/interface/web/client/list/domain.list.php
+++ b/interface/web/client/list/domain.list.php
@@ -75,6 +75,9 @@ $liste["auth"]				= "yes";
 *****************************************************/
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "LIKE",
 							'prefix'	=> "%",
diff --git a/interface/web/dns/form/dns_a.tform.php b/interface/web/dns/form/dns_a.tform.php
index 50950c085..bbd0d0107 100644
--- a/interface/web/dns/form/dns_a.tform.php
+++ b/interface/web/dns/form/dns_a.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-\*]{0,64}$/',
 														'errmsg'=> 'name_error_regex'),
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index c998f8151..b358b720c 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'name_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
@@ -100,6 +107,13 @@ $form["tabs"]['dns'] = array (
 		'data' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'data_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php
index c9e9d9bcd..ccfef7368 100644
--- a/interface/web/dns/form/dns_cname.tform.php
+++ b/interface/web/dns/form/dns_cname.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-\*]{0,255}$/',
 														'errmsg'=> 'name_error_regex'),
@@ -98,6 +105,13 @@ $form["tabs"]['dns'] = array (
 		'data' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'data_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_hinfo.tform.php b/interface/web/dns/form/dns_hinfo.tform.php
index 556d57344..70971cf77 100644
--- a/interface/web/dns/form/dns_hinfo.tform.php
+++ b/interface/web/dns/form/dns_hinfo.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'name_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_mx.tform.php b/interface/web/dns/form/dns_mx.tform.php
index df8ef7263..a1f7b78b9 100644
--- a/interface/web/dns/form/dns_mx.tform.php
+++ b/interface/web/dns/form/dns_mx.tform.php
@@ -79,6 +79,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-\*]{0,255}$/',
 														'errmsg'=> 'name_error_regex'),
@@ -99,6 +106,13 @@ $form["tabs"]['dns'] = array (
 		'data' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'data_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php
index 2efa866fa..00a842f84 100644
--- a/interface/web/dns/form/dns_ns.tform.php
+++ b/interface/web/dns/form/dns_ns.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-]{0,255}$/',
 														'errmsg'=> 'name_error_regex'),
@@ -98,6 +105,13 @@ $form["tabs"]['dns'] = array (
 		'data' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'data_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_ptr.tform.php b/interface/web/dns/form/dns_ptr.tform.php
index 4b1a2d824..68ea83c54 100644
--- a/interface/web/dns/form/dns_ptr.tform.php
+++ b/interface/web/dns/form/dns_ptr.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-]{1,256}$/',
 														'errmsg'=> 'name_error_regex'),
@@ -98,6 +105,13 @@ $form["tabs"]['dns'] = array (
 		'data' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'data_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php
index 35737a27a..f6a6ef5ee 100644
--- a/interface/web/dns/form/dns_rp.tform.php
+++ b/interface/web/dns/form/dns_rp.tform.php
@@ -75,6 +75,13 @@ $form["tabs"]['dns'] = array (
 			'width'		=> '30',
 			'maxlength'	=> '255'
 		),
+        'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                          'type' => 'IDNTOASCII'),
+                              1 => array( 'event' => 'SHOW',
+                                          'type' => 'IDNTOUTF8'),
+                              2 => array( 'event' => 'SAVE',
+                                          'type' => 'TOLOWER')
+                            ),
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
diff --git a/interface/web/dns/form/dns_slave.tform.php b/interface/web/dns/form/dns_slave.tform.php
index a1dea941f..038f26bd9 100644
--- a/interface/web/dns/form/dns_slave.tform.php
+++ b/interface/web/dns/form/dns_slave.tform.php
@@ -82,6 +82,13 @@ $form["tabs"]['dns_slave'] = array (
 		'origin' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'origin_error_empty'),
 										1 => array (	'type'	=> 'UNIQUE',
@@ -99,6 +106,13 @@ $form["tabs"]['dns_slave'] = array (
 		'ns' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-]{1,255}$/',
 														'errmsg'=> 'ns_error_regex'),
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index 175bb12ee..00c2aaceb 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -83,6 +83,13 @@ $form["tabs"]['dns_soa'] = array (
 		'origin' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'origin_error_empty'),
 										1 => array (	'type'	=> 'UNIQUE',
@@ -100,6 +107,13 @@ $form["tabs"]['dns_soa'] = array (
 		'ns' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-]{1,255}$/',
 														'errmsg'=> 'ns_error_regex'),
@@ -113,6 +127,13 @@ $form["tabs"]['dns_soa'] = array (
 		'mbox' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'mbox_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php
index 25f3584ae..736bbc920 100644
--- a/interface/web/dns/form/dns_srv.tform.php
+++ b/interface/web/dns/form/dns_srv.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-]{0,255}$/',
 														'errmsg'=> 'name_error_regex'),
diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php
index ad68d9781..c59fa75e5 100644
--- a/interface/web/dns/form/dns_txt.tform.php
+++ b/interface/web/dns/form/dns_txt.tform.php
@@ -78,6 +78,13 @@ $form["tabs"]['dns'] = array (
 		'name' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^[\w\.\-]{0,255}$/',
 														'errmsg'=> 'name_error_regex'),
diff --git a/interface/web/dns/list/dns_a.list.php b/interface/web/dns/list/dns_a.list.php
index 7484195b9..75076d017 100644
--- a/interface/web/dns/list/dns_a.list.php
+++ b/interface/web/dns/list/dns_a.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "zone",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/dns/list/dns_slave.list.php b/interface/web/dns/list/dns_slave.list.php
index 1e6354434..527655717 100644
--- a/interface/web/dns/list/dns_slave.list.php
+++ b/interface/web/dns/list/dns_slave.list.php
@@ -73,6 +73,9 @@ $liste["item"][] = array(   'field'	=> "server_id",
 
 $liste["item"][] = array(   'field'	=> "origin",
                             'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
                             'formtype'	=> "TEXT",
                             'op'	=> "like",
                             'prefix'	=> "%",
@@ -83,6 +86,9 @@ $liste["item"][] = array(   'field'	=> "origin",
 
 $liste["item"][] = array(   'field'	=> "ns",
                             'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
                             'formtype'	=> "TEXT",
                             'op'	=> "like",
                             'prefix'	=> "%",
diff --git a/interface/web/dns/list/dns_soa.list.php b/interface/web/dns/list/dns_soa.list.php
index 89cc766d1..46ec9c9b8 100644
--- a/interface/web/dns/list/dns_soa.list.php
+++ b/interface/web/dns/list/dns_soa.list.php
@@ -73,6 +73,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "origin",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
@@ -83,6 +86,9 @@ $liste["item"][] = array(	'field'		=> "origin",
 
 $liste["item"][] = array(	'field'		=> "ns",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
@@ -93,6 +99,9 @@ $liste["item"][] = array(	'field'		=> "ns",
 
 $liste["item"][] = array(	'field'		=> "mbox",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/form/mail_alias.tform.php b/interface/web/mail/form/mail_alias.tform.php
index 072f62200..181cdc9f3 100644
--- a/interface/web/mail/form/mail_alias.tform.php
+++ b/interface/web/mail/form/mail_alias.tform.php
@@ -74,6 +74,13 @@ $form["tabs"]['alias'] = array (
 		'source' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
 														'errmsg'=> 'email_error_isemail'),
 									),
@@ -86,6 +93,13 @@ $form["tabs"]['alias'] = array (
 		'destination' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'SELECT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'datasource'	=> array ( 	'type'			=> 'SQL',
 										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
diff --git a/interface/web/mail/form/mail_aliasdomain.tform.php b/interface/web/mail/form/mail_aliasdomain.tform.php
index 754209f3a..29ed73f98 100644
--- a/interface/web/mail/form/mail_aliasdomain.tform.php
+++ b/interface/web/mail/form/mail_aliasdomain.tform.php
@@ -74,6 +74,13 @@ $form["tabs"]['alias'] = array (
 		'source' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'source_error_empty'),
 										1 => array (	'type'	=> 'UNIQUE',
@@ -91,6 +98,13 @@ $form["tabs"]['alias'] = array (
 		'destination' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
diff --git a/interface/web/mail/form/mail_domain.tform.php b/interface/web/mail/form/mail_domain.tform.php
index 9396b814b..506f934e3 100644
--- a/interface/web/mail/form/mail_domain.tform.php
+++ b/interface/web/mail/form/mail_domain.tform.php
@@ -77,9 +77,13 @@ $form["tabs"]['domain'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
-			'filters'	=> array ( 		0 => array (	'type'	=> 'TOLOWER',
-														'event'=> 'SAVE'),
-									),
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'domain_error_empty'),
 										1 => array (	'type'	=> 'UNIQUE',
diff --git a/interface/web/mail/form/mail_domain_catchall.tform.php b/interface/web/mail/form/mail_domain_catchall.tform.php
index b308ed6c9..ea8fb564a 100644
--- a/interface/web/mail/form/mail_domain_catchall.tform.php
+++ b/interface/web/mail/form/mail_domain_catchall.tform.php
@@ -74,6 +74,13 @@ $form["tabs"]['catchall'] = array (
 		'source' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'domain_error_empty'),
 										1 => array (	'type'	=> 'UNIQUE',
@@ -91,6 +98,13 @@ $form["tabs"]['catchall'] = array (
 		'destination' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			/*
 			'datasource'	=> array ( 	'type'			=> 'SQL',
diff --git a/interface/web/mail/form/mail_forward.tform.php b/interface/web/mail/form/mail_forward.tform.php
index b8f25758e..cdfb785f3 100644
--- a/interface/web/mail/form/mail_forward.tform.php
+++ b/interface/web/mail/form/mail_forward.tform.php
@@ -74,6 +74,13 @@ $form["tabs"]['forward'] = array (
 		'source' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
 														'errmsg'=> 'email_error_isemail'),
 									),
@@ -86,6 +93,13 @@ $form["tabs"]['forward'] = array (
 		'destination' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
diff --git a/interface/web/mail/form/mail_get.tform.php b/interface/web/mail/form/mail_get.tform.php
index 4086eb90e..e23c4e1b2 100644
--- a/interface/web/mail/form/mail_get.tform.php
+++ b/interface/web/mail/form/mail_get.tform.php
@@ -84,6 +84,13 @@ $form["tabs"]['mailget'] = array (
 		'source_server' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'source_server_error_isempty'),
 										1 => array (	'type'	=> 'REGEX',
@@ -134,6 +141,13 @@ $form["tabs"]['mailget'] = array (
 		'destination' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'SELECT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'datasource'	=> array ( 	'type'			=> 'SQL',
 										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
diff --git a/interface/web/mail/form/mail_mailinglist.tform.php b/interface/web/mail/form/mail_mailinglist.tform.php
index 93bd8c206..7ccf1f6ef 100644
--- a/interface/web/mail/form/mail_mailinglist.tform.php
+++ b/interface/web/mail/form/mail_mailinglist.tform.php
@@ -77,6 +77,13 @@ $form["tabs"]['mailinglist'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'domain_error_empty'),
 										1 => array (	'type'	=> 'REGEX',
@@ -104,6 +111,13 @@ $form["tabs"]['mailinglist'] = array (
 		'email' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
 														'errmsg'=> 'email_error_isemail'),
 									),
diff --git a/interface/web/mail/form/mail_transport.tform.php b/interface/web/mail/form/mail_transport.tform.php
index d7935a6fa..a7ae27d99 100644
--- a/interface/web/mail/form/mail_transport.tform.php
+++ b/interface/web/mail/form/mail_transport.tform.php
@@ -77,6 +77,13 @@ $form["tabs"]['transport'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php
index 0dd7c8f98..f01e96eda 100644
--- a/interface/web/mail/form/mail_user.tform.php
+++ b/interface/web/mail/form/mail_user.tform.php
@@ -75,6 +75,13 @@ $form["tabs"]['mailuser'] = array (
 		'email' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
 														'errmsg'=> 'email_error_isemail'),
 										1 => array (	'type'	=> 'UNIQUE',
@@ -136,6 +143,13 @@ $form["tabs"]['mailuser'] = array (
 		'cc' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
 														'errmsg'=> 'cc_error_isemail'),
diff --git a/interface/web/mail/form/spamfilter_config.tform.php b/interface/web/mail/form/spamfilter_config.tform.php
index 3f5d582e2..224cb606c 100644
--- a/interface/web/mail/form/spamfilter_config.tform.php
+++ b/interface/web/mail/form/spamfilter_config.tform.php
@@ -95,6 +95,13 @@ $form["tabs"]['server'] = array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
 			'default'	=> 'server1.domain.tld',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'hostname_error_empty'),
 									),
diff --git a/interface/web/mail/form/spamfilter_users.tform.php b/interface/web/mail/form/spamfilter_users.tform.php
index b14fb78eb..980a64fd3 100644
--- a/interface/web/mail/form/spamfilter_users.tform.php
+++ b/interface/web/mail/form/spamfilter_users.tform.php
@@ -90,6 +90,13 @@ $form["tabs"]['users'] = array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
 			'default'	=> '',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'email_error_notempty'),
 									),
diff --git a/interface/web/mail/form/spamfilter_whitelist.tform.php b/interface/web/mail/form/spamfilter_whitelist.tform.php
index 4d476a75d..73d53f887 100644
--- a/interface/web/mail/form/spamfilter_whitelist.tform.php
+++ b/interface/web/mail/form/spamfilter_whitelist.tform.php
@@ -90,6 +90,13 @@ $form["tabs"]['whitelist'] = array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
 			'default'	=> '',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'email_error_notempty'),
 									),
diff --git a/interface/web/mail/list/mail_alias.list.php b/interface/web/mail/list/mail_alias.list.php
index 2b5e773cb..101644410 100644
--- a/interface/web/mail/list/mail_alias.list.php
+++ b/interface/web/mail/list/mail_alias.list.php
@@ -59,6 +59,9 @@ $liste["item"][] = array(	'field'		=> "active",
 
 $liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
@@ -68,6 +71,9 @@ $liste["item"][] = array(	'field'		=> "source",
 
 $liste["item"][] = array(	'field'		=> "destination",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_aliasdomain.list.php b/interface/web/mail/list/mail_aliasdomain.list.php
index aa11ded0a..f4385d8ef 100644
--- a/interface/web/mail/list/mail_aliasdomain.list.php
+++ b/interface/web/mail/list/mail_aliasdomain.list.php
@@ -59,6 +59,9 @@ $liste["item"][] = array(	'field'		=> "active",
 
 $liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
@@ -68,6 +71,9 @@ $liste["item"][] = array(	'field'		=> "source",
 
 $liste["item"][] = array(	'field'		=> "destination",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index 310ec88b1..0012e1c83 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -95,6 +95,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_domain_catchall.list.php b/interface/web/mail/list/mail_domain_catchall.list.php
index 99b8c2cbf..07f7e9f14 100644
--- a/interface/web/mail/list/mail_domain_catchall.list.php
+++ b/interface/web/mail/list/mail_domain_catchall.list.php
@@ -59,6 +59,9 @@ $liste["item"][] = array(	'field'		=> "active",
 
 $liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
@@ -68,6 +71,9 @@ $liste["item"][] = array(	'field'		=> "source",
 
 $liste["item"][] = array(	'field'		=> "destination",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_forward.list.php b/interface/web/mail/list/mail_forward.list.php
index 6f1e230c5..5aae2bb4a 100644
--- a/interface/web/mail/list/mail_forward.list.php
+++ b/interface/web/mail/list/mail_forward.list.php
@@ -59,6 +59,9 @@ $liste["item"][] = array(	'field'		=> "active",
 
 $liste["item"][] = array(	'field'		=> "source",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
@@ -68,6 +71,9 @@ $liste["item"][] = array(	'field'		=> "source",
 
 $liste["item"][] = array(	'field'		=> "destination",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_get.list.php b/interface/web/mail/list/mail_get.list.php
index 7e532f471..bcce2c077 100644
--- a/interface/web/mail/list/mail_get.list.php
+++ b/interface/web/mail/list/mail_get.list.php
@@ -91,6 +91,9 @@ $liste["item"][] = array(	'field'		=> "source_username",
 
 $liste["item"][] = array(	'field'		=> "destination",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_mailinglist.list.php b/interface/web/mail/list/mail_mailinglist.list.php
index 27657d51d..4bc3b0612 100644
--- a/interface/web/mail/list/mail_mailinglist.list.php
+++ b/interface/web/mail/list/mail_mailinglist.list.php
@@ -57,6 +57,9 @@ $liste["item"][] = array(	'field'		=> "listname",
 							
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_transport.list.php b/interface/web/mail/list/mail_transport.list.php
index d882c6fb8..ccea270ea 100644
--- a/interface/web/mail/list/mail_transport.list.php
+++ b/interface/web/mail/list/mail_transport.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/mail_user.list.php b/interface/web/mail/list/mail_user.list.php
index 8306001e2..7e7868391 100644
--- a/interface/web/mail/list/mail_user.list.php
+++ b/interface/web/mail/list/mail_user.list.php
@@ -49,6 +49,9 @@ $liste["auth"]			= "yes";
 
 $liste["item"][] = array(   'field'     => "email",
                             'datatype'  => "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
                             'formtype'  => "TEXT",
                             'op'        => "like",
                             'prefix'    => "%",
diff --git a/interface/web/mail/list/mail_user_stats.list.php b/interface/web/mail/list/mail_user_stats.list.php
index 8705defb1..aa144313f 100644
--- a/interface/web/mail/list/mail_user_stats.list.php
+++ b/interface/web/mail/list/mail_user_stats.list.php
@@ -49,6 +49,9 @@ $liste["auth"]				= "yes";
 
 $liste["item"][] = array(	'field'		=> "email",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/mail/list/user_quota_stats.list.php b/interface/web/mail/list/user_quota_stats.list.php
index 0472afb26..1123b935e 100644
--- a/interface/web/mail/list/user_quota_stats.list.php
+++ b/interface/web/mail/list/user_quota_stats.list.php
@@ -47,6 +47,9 @@ $liste["auth"]				= "yes";
 
 $liste["item"][] = array(   'field'     => "email",
                             'datatype'  => "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
                             'formtype'  => "TEXT",
                             'op'        => "like",
                             'prefix'    => "%",
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index ce5e7cc25..7c1d7dff3 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -140,7 +140,7 @@ class page_action extends tform_actions {
 					if ($domain['domain'] == $this->dataRecord["domain"]) {
 						$domain_select .= " selected";
 					}
-					$domain_select .= ">" . $domain['domain'] . "</option>\r\n";
+					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
 			}
 			else {
diff --git a/interface/web/mailuser/form/mail_user_cc.tform.php b/interface/web/mailuser/form/mail_user_cc.tform.php
index c46bed186..222745d9c 100644
--- a/interface/web/mailuser/form/mail_user_cc.tform.php
+++ b/interface/web/mailuser/form/mail_user_cc.tform.php
@@ -61,6 +61,13 @@ $form["tabs"]['mailuser'] = array (
 		'cc' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
 														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
 														'errmsg'=> 'cc_error_isemail'),
diff --git a/interface/web/sites/form/web_aliasdomain.tform.php b/interface/web/sites/form/web_aliasdomain.tform.php
index 342272e95..d77d584d3 100644
--- a/interface/web/sites/form/web_aliasdomain.tform.php
+++ b/interface/web/sites/form/web_aliasdomain.tform.php
@@ -72,6 +72,13 @@ $form["tabs"]['domain'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
             'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
                                                         'class' => 'validate_domain',
                                                         'function' => 'alias_domain',
diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php
index 673662fa3..6b1d7f770 100644
--- a/interface/web/sites/form/web_domain.tform.php
+++ b/interface/web/sites/form/web_domain.tform.php
@@ -119,14 +119,18 @@ $form["tabs"]['domain'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
             'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
                                                         'class' => 'validate_domain',
                                                         'function' => 'web_domain',
                                                         'errmsg'=> 'domain_error_regex'),
                                     ),
-			'filters'	=> array ( 	0 => array (	'event'	=> 'SAVE',
-													'type'	=> 'TOLOWER'),
-									),
 			'default'	=> '',
 			'value'		=> '',
 			'width'		=> '30',
diff --git a/interface/web/sites/form/web_subdomain.tform.php b/interface/web/sites/form/web_subdomain.tform.php
index d8d6c2c52..633786a61 100644
--- a/interface/web/sites/form/web_subdomain.tform.php
+++ b/interface/web/sites/form/web_subdomain.tform.php
@@ -72,6 +72,13 @@ $form["tabs"]['domain'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
             'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
                                                         'class' => 'validate_domain',
                                                         'function' => 'sub_domain',
diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php
index 3440eba59..da017c401 100644
--- a/interface/web/sites/form/web_vhost_subdomain.tform.php
+++ b/interface/web/sites/form/web_vhost_subdomain.tform.php
@@ -111,6 +111,13 @@ $form["tabs"]['domain'] = array (
 		'domain' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
             'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
                                                         'class' => 'validate_domain',
                                                         'function' => 'sub_domain',
diff --git a/interface/web/sites/list/ftp_user.list.php b/interface/web/sites/list/ftp_user.list.php
index 45f0a90fa..2c64a9487 100644
--- a/interface/web/sites/list/ftp_user.list.php
+++ b/interface/web/sites/list/ftp_user.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "parent_domain_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
diff --git a/interface/web/sites/list/shell_user.list.php b/interface/web/sites/list/shell_user.list.php
index ac4de6e04..2dd2b4ea2 100644
--- a/interface/web/sites/list/shell_user.list.php
+++ b/interface/web/sites/list/shell_user.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "parent_domain_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
diff --git a/interface/web/sites/list/user_quota_stats.list.php b/interface/web/sites/list/user_quota_stats.list.php
index b43fc9819..c3999c29d 100644
--- a/interface/web/sites/list/user_quota_stats.list.php
+++ b/interface/web/sites/list/user_quota_stats.list.php
@@ -49,6 +49,9 @@ $liste["auth"]				= "yes";
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/sites/list/web_aliasdomain.list.php b/interface/web/sites/list/web_aliasdomain.list.php
index dcff7d10f..a6921565d 100644
--- a/interface/web/sites/list/web_aliasdomain.list.php
+++ b/interface/web/sites/list/web_aliasdomain.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "parent_domain_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
@@ -88,6 +91,9 @@ $liste["item"][] = array(	'field'		=> "parent_domain_id",
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/sites/list/web_domain.list.php b/interface/web/sites/list/web_domain.list.php
index e8633091e..8f98f6e13 100644
--- a/interface/web/sites/list/web_domain.list.php
+++ b/interface/web/sites/list/web_domain.list.php
@@ -102,6 +102,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/sites/list/web_folder.list.php b/interface/web/sites/list/web_folder.list.php
index b8b22a0a7..dfcb3799d 100644
--- a/interface/web/sites/list/web_folder.list.php
+++ b/interface/web/sites/list/web_folder.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "parent_domain_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
diff --git a/interface/web/sites/list/web_folder_user.list.php b/interface/web/sites/list/web_folder_user.list.php
index 5b8324ace..f2843660d 100644
--- a/interface/web/sites/list/web_folder_user.list.php
+++ b/interface/web/sites/list/web_folder_user.list.php
@@ -62,6 +62,9 @@ $liste["item"][] = array(	'field'		=> "active",
 
 $liste["item"][] = array(	'field'		=> "web_folder_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
diff --git a/interface/web/sites/list/web_sites_stats.list.php b/interface/web/sites/list/web_sites_stats.list.php
index c6ffd3ee4..8539c7e55 100644
--- a/interface/web/sites/list/web_sites_stats.list.php
+++ b/interface/web/sites/list/web_sites_stats.list.php
@@ -49,6 +49,9 @@ $liste["auth"]				= "yes";
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/sites/list/web_subdomain.list.php b/interface/web/sites/list/web_subdomain.list.php
index 2664f447e..637de0e14 100644
--- a/interface/web/sites/list/web_subdomain.list.php
+++ b/interface/web/sites/list/web_subdomain.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "parent_domain_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
@@ -88,6 +91,9 @@ $liste["item"][] = array(	'field'		=> "parent_domain_id",
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/sites/list/web_vhost_subdomain.list.php b/interface/web/sites/list/web_vhost_subdomain.list.php
index 7b7a8d770..192613c29 100644
--- a/interface/web/sites/list/web_vhost_subdomain.list.php
+++ b/interface/web/sites/list/web_vhost_subdomain.list.php
@@ -74,6 +74,9 @@ $liste["item"][] = array(	'field'		=> "server_id",
 
 $liste["item"][] = array(	'field'		=> "parent_domain_id",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "SELECT",
 							'op'		=> "=",
 							'prefix'	=> "",
@@ -88,6 +91,9 @@ $liste["item"][] = array(	'field'		=> "parent_domain_id",
 
 $liste["item"][] = array(	'field'		=> "domain",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 47fdf4cac..6025fc956 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -99,7 +99,7 @@ class page_action extends tform_actions {
 					if ($domain['domain'] == $this->dataRecord["domain"]) {
 						$domain_select .= " selected";
 					}
-					$domain_select .= ">" . $domain['domain'] . "</option>\r\n";
+					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
 			}
 			else {
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index ca57df34b..142c7d2a3 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -432,7 +432,7 @@ class page_action extends tform_actions {
 					if ($domain['domain'] == $this->dataRecord["domain"]) {
 						$domain_select .= " selected";
 					}
-					$domain_select .= ">" . $domain['domain'] . "</option>\r\n";
+					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
 			}
 			else {
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index ad0079477..577078b08 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -97,7 +97,7 @@ class page_action extends tform_actions {
 						$domain_select .= " selected";
                         $selected_domain = $domain['domain'];
 					}
-					$domain_select .= ">" . $domain['domain'] . "</option>\r\n";
+					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
 			}
 			else {
diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index 62e351aed..761be8801 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -252,7 +252,7 @@ class page_action extends tform_actions {
 						$domain_select .= " selected";
                         $selected_domain = $domain['domain'];
 					}
-					$domain_select .= ">" . $domain['domain'] . "</option>\r\n";
+					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
 			}
 			else {
diff --git a/interface/web/vm/form/openvz_vm.tform.php b/interface/web/vm/form/openvz_vm.tform.php
index 229d9df63..efd9c842f 100644
--- a/interface/web/vm/form/openvz_vm.tform.php
+++ b/interface/web/vm/form/openvz_vm.tform.php
@@ -117,6 +117,13 @@ $form["tabs"]['main'] = array (
 		'hostname' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
+            'filters'   => array( 0 => array( 'event' => 'SAVE',
+                                              'type' => 'IDNTOASCII'),
+                                  1 => array( 'event' => 'SHOW',
+                                              'type' => 'IDNTOUTF8'),
+                                  2 => array( 'event' => 'SAVE',
+                                              'type' => 'TOLOWER')
+                                ),
 			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'hostname_error_empty'),
 									),
diff --git a/interface/web/vm/list/openvz_vm.list.php b/interface/web/vm/list/openvz_vm.list.php
index 0d9c5e628..016165b0f 100644
--- a/interface/web/vm/list/openvz_vm.list.php
+++ b/interface/web/vm/list/openvz_vm.list.php
@@ -109,6 +109,9 @@ $liste["item"][] = array(	'field'		=> "template_id",
 							
 $liste["item"][] = array(	'field'		=> "hostname",
 							'datatype'	=> "VARCHAR",
+                            'filters'   => array( 0 => array( 'event' => 'SHOW',
+                                                              'type' => 'IDNTOUTF8')
+                                                ),
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "%",
-- 
GitLab