Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unicode support
#1
I'm using some special characters in dokument names, keyword etc. They are well represented when are entered in form, but after they are the stored in database they become messed.

First thing that should be done is to add red line in the function htmlStartPage in inc.ClassUI.php

Quote: function htmlStartPage($title="", $bodyClass="") {
global $theme, $settings;
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n".
"\"http://www.w3.org/TR/html4/strict.dtd\">\n";
echo "<html>\n<head>\n";
echo "<meta http-equiv='content-type' content='text/html; charset=UTF-8' />";
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"../styles/".$theme."/style.css\"/>\n";
echo "<link rel=\"STYLESHEET\" type=\"text/css\" href=\"../styles/print.css\" media=\"print\"/>\n";
echo "<link rel='shortcut icon' href='../styles/".$theme."/favicon.ico' type='image/x-icon'/>\n";
echo "<title>".(strlen($settings->_siteName)>0 ? $settings->_siteName : "MyDMS").(strlen($title)>0 ? ": " : "").$title."</title>\n";
echo "</head>\n";
echo "<body".(strlen($bodyClass)>0 ? " class=\"".$bodyClass."\"" : "").">\n";
}


Second thing I do is to convert mydms database to utf8 character set using below attached php script. Script should be edited according to db setup (host, username, pass)

Quote:<?php
// your connection
mysql_connect("localhost","root","");
mysql_select_db("mydms");

// convert code
$res = mysql_query("SHOW TABLES");
while ($row = mysql_fetch_array($res))
{
foreach ($row as $key => $table)
{
mysql_query("ALTER TABLE " . $table . " CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci");
echo $key . " =&gt; " . $table . " CONVERTED<br />";
}
}
?>


I don't know if that should stay in bugs section or this should go somewhere else, but I hope that administrator will Smile
Reply
#2
For some specific languages with special characters in "day of week"-names you have to change inc.Calendar.php - change line:
$dayNames[] = substr($dn,0,2);

to:
$dayNames[] = mb_substr($dn,0,2,"utf-8");

This requires mbstring library (Multibyte support) loaded in PHP.

Patch for LetoDMS 2.0.2 is in attachment.
Reply
#3
One more modification to correct work with UTF-8 - edit file out/out.ViewFolder.php .
Locate this line (2x - lines 100 and 120):
PHP Code:
    if (strlen($comment) > 50$comment substr($comment047) . "..."

change to:
PHP Code:
    if (strlen($comment) > 50$comment mb_substr($comment047"utf-8") . "..."

Reply
#4
viewed name UTF-8 unicode-ci Projects idea
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)