<?php
/**
- * functions/i18n.php
+ * SquirrelMail internationalization functions
*
* Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
return( $ret );
}
+/**
+ * Converts html string to given charset
+ * @param string $string
+ * @param string $charset
+ * @param boolean $htmlencode keep htmlspecialchars encoding
+ * @param string
+ */
+function charset_encode($string,$charset,$htmlencode=true) {
+ global $default_charset;
+
+ // Undo html special chars
+ if (! $htmlencode ) {
+ $string = str_replace(array('&','>','<','"'),array('&','>','<','"'),$string);
+ }
+
+ $encode=fixcharset($charset);
+ $encodefile=SM_PATH . 'functions/encode/' . $encode . '.php';
+ if (file_exists($encodefile)) {
+ include_once($encodefile);
+ $ret = call_user_func('charset_encode_'.$encode, $string);
+ } else {
+ $ret = $string;
+ }
+ return( $ret );
+}
+
+/**
+ * Combined decoding and encoding functions
+ *
+ * If conversion is done to charset different that utf-8, unsupported symbols
+ * will be replaced with question marks.
+ * @param string $in_charset initial charset
+ * @param string $string string that has to be converted
+ * @param string $out_charset final charset
+ * @param boolean $htmlencode keep htmlspecialchars encoding
+ * @return string converted string
+ */
+function charset_convert($in_charset,$string,$out_charset,$htmlencode=true) {
+ $string=charset_decode($in_charset,$string);
+ $string=charset_encode($string,$out_charset,$htmlencode);
+ return $string;
+}
+
/**
* Makes charset name suitable for decoding cycles
*
$languages['et_EE']['LOCALE'] = 'et_EE.ISO8859-15';
$languages['et']['ALIAS'] = 'et_EE';
+$languages['eu_ES']['NAME'] = 'Basque';
+$languages['eu_ES']['CHARSET'] = 'iso-8859-1';
+$languages['eu_ES']['LOCALE'] = 'eu_ES.ISO8859-1';
+$languages['eu']['ALIAS'] = 'eu_ES';
+
$languages['fo_FO']['NAME'] = 'Faroese';
$languages['fo_FO']['CHARSET'] = 'iso-8859-1';
$languages['fo_FO']['LOCALE'] = 'fo_FO.ISO8859-1';
$languages['ko_KR']['NAME'] = 'Korean';
$languages['ko_KR']['CHARSET'] = 'euc-KR';
$languages['ko_KR']['LOCALE'] = 'ko_KR.EUC-KR';
-$languages['ko_KR']['XTRA_CODE'] = 'korean_charset_xtra';
+// Function does not provide all needed options
+// $languages['ko_KR']['XTRA_CODE'] = 'korean_charset_xtra';
$languages['ko']['ALIAS'] = 'ko_KR';
$languages['lt_LT']['NAME'] = 'Lithuanian';