meeting-room-booking-system / mrbs-code

MRBS application code
Other
127 stars 62 forks source link

Calendar display garbled #2461

Open jberanek opened 5 years ago

jberanek commented 5 years ago

Mbrs1.7.1 version The calendar shows garbled characters, PHP and MYSQL have specified UTF8, still the same

Reported by: *anonymous

Original Ticket: mrbs/support-requests/1759

jberanek commented 5 years ago

Which fields are garbled? Can you give a screenshot?

If the text has come from the config file, have you saved the config file as UTF8?

Original comment by: campbell-m

jberanek commented 5 years ago

https://ithelp.ithome.com.tw/upload/images/20190509/20117510HVg8LRZA2a.jpg

The installation version is 1.7.1 mbrs Language setting $ timezone = "Asia / Taipei"; Also Work.php day.php month.php config.ini has been added Header("Content-Type:text / html; charset = utf-8"); As shown in the figure below The garbled problem still can't be solved

Original comment by: *anonymous

jberanek commented 5 years ago

https://ithelp.ithome.com.tw/upload/images/20190510/20117510doeVLxJFN2.jpg https://ithelp.ithome.com.tw/upload/images/20190509/20117510HVg8LRZA2a.jpg https://ithelp.ithome.com.tw/upload/images/20190510/20117510bKHdFouMkR.jpg

Original comment by: *anonymous

jberanek commented 5 years ago

What have you got the following variables set to in your config file?

$disable_automatic_language_changing $default_language_tokens $override_locale

Original comment by: campbell-m

jberanek commented 5 years ago

config.ini.php Without these three variables

Original comment by: *anonymous

jberanek commented 5 years ago

What are your browser language settings as given on the Help page?

Original comment by: campbell-m

jberanek commented 5 years ago

How is the text "garbled"? It looks like your PC is configured for a Chinese locale, and MRBS has served you Chinese dates...

Original comment by: jberanek

jberanek commented 5 years ago

I tried Chrome and IE but is still the same

Original comment by: *anonymous

jberanek commented 5 years ago

I am going to change lang.zh-tw, the content will still date or garbled

Original comment by: *anonymous

jberanek commented 5 years ago

If I change the English version, should I adjust that variable? I am going to change $timezone to have no effect.

Original comment by: *anonymous

jberanek commented 5 years ago

What are your browser language settings as given on the Help page?

Original comment by: campbell-m

jberanek commented 5 years ago

No, changing $timezone won't make a difference. And you shouldn't edit the lang files. If you do want to change text strings then you should use the $vocab_override config settings. But they won't make a difference as the calendar text comes from your locale setting, which is determined by those three config variables above and your browser language settings.

Original comment by: campbell-m

jberanek commented 5 years ago

I do not quite understand you

Original comment by: *anonymous

jberanek commented 5 years ago

Go to help.php and MRBS will show you your browser's language preferences.

Original comment by: campbell-m

jberanek commented 5 years ago

My browser language is Chinese, but I didn't see the three variables mentioned above.

Original comment by: *anonymous

jberanek commented 5 years ago

On the MRBS Help page you should see something like:

About MRBS
Meeting Room Booking System MRBS 1.7.3
Your browser is set with the following language preference order: en-GB, en-US, en

Original comment by: campbell-m

jberanek commented 5 years ago

The following is my help.php`, I don't see the language option.

<?php
namespace MRBS;
header("Content-Type:text/html; charset=utf-8");
require "defaultincludes.inc";
require_once "version.inc";

// Check the user is authorised for this page
checkAuthorised();

$user = getUserName();
$is_admin = (authGetUserLevel($user) >= $max_level);

print_header($day, $month, $year, $area, isset($room) ? $room : null);

echo "<h3>" . get_vocab("about_mrbs") . "</h3>\n";

if (!$is_admin)
{
  echo "<table class=\"details list\">\n";
  echo "<tr><td><a href=\"http://mrbs.sourceforge.net\">" . get_vocab("mrbs") . "</a></td><td>" . get_mrbs_version() . "</td></tr>\n";
  echo "</table>\n";
}
else
{
  // Restrict the configuration and server details to admins, for security reasons.
  echo "<table class=\"details has_caption list\">\n";
  echo "<caption>" . get_vocab("config_details") . "</caption>\n";
  echo "<tr><td>" . get_vocab("mrbs_version") . "</td><td>" . get_mrbs_version() . "</td></tr>\n";
  echo '<tr><td>$auth[\'type\']</td><td>' . htmlspecialchars($auth['type']) . "</td></tr>\n";
  echo '<tr><td>$auth[\'session\']</td><td>' . htmlspecialchars($auth['session']) . "</td></tr>\n";
  echo "</table>\n";

  echo "<table class=\"details has_caption list\">\n";
  echo "<caption>" . get_vocab("server_details") . "</caption>\n";
  echo "<tr><td>" . get_vocab("database") . "</td><td>" . db()->version() . "</td></tr>\n";
  echo "<tr><td>" . get_vocab("system") . "</td><td>" . php_uname() . "</td></tr>\n";
  echo "<tr><td>" . get_vocab("servertime") . "</td><td>" .
       utf8_strftime($strftime_format['datetime'], time()) .
       "</td></tr>\n";
  echo "<tr><td>" . get_vocab("server_software") . "</td><td>" . htmlspecialchars(get_server_software()) . "</td></tr>\n";
  echo "<tr><td>PHP</td><td>" . phpversion() . "</td></tr>\n";
  echo "</table>\n";
}

echo "<p>\n" . get_vocab("browserlang") .":\n";

echo htmlspecialchars(implode(", ", array_keys(get_language_qualifiers())));

echo "\n</p>\n";

echo "<h3>" . get_vocab("help") . "</h3>\n";
echo "<p>\n";
echo get_vocab("please_contact") . '<a href="mailto:' . rawurlencode($mrbs_admin_email)
  . '">' . htmlspecialchars($mrbs_admin)
  . "</a> " . get_vocab("for_any_questions") . "\n";
echo "</p>\n";

require_once "site_faq/site_faq" . $faqfilelang . ".html";

output_trailer();

Original comment by: *anonymous

jberanek commented 5 years ago
namespace MRBS;
header("Content-Type:text/html; charset=utf-8");
require "defaultincludes.inc";
require_once "version.inc";

// Check the user is authorised for this page
checkAuthorised();

$user = getUserName();
$is_admin = (authGetUserLevel($user) >= $max_level);

print_header($day, $month, $year, $area, isset($room) ? $room : null);

echo "<h3>" . get_vocab("about_mrbs") . "</h3>\n";

if (!$is_admin)
{
  echo "<table class=\"details list\">\n";
  echo "<tr><td><a href=\"http://mrbs.sourceforge.net\">" . get_vocab("mrbs") . "</a></td><td>" . get_mrbs_version() . "</td></tr>\n";
  echo "</table>\n";
}
else
{
  // Restrict the configuration and server details to admins, for security reasons.
  echo "<table class=\"details has_caption list\">\n";
  echo "<caption>" . get_vocab("config_details") . "</caption>\n";
  echo "<tr><td>" . get_vocab("mrbs_version") . "</td><td>" . get_mrbs_version() . "</td></tr>\n";
  echo '<tr><td>$auth[\'type\']</td><td>' . htmlspecialchars($auth['type']) . "</td></tr>\n";
  echo '<tr><td>$auth[\'session\']</td><td>' . htmlspecialchars($auth['session']) . "</td></tr>\n";
  echo "</table>\n";

  echo "<table class=\"details has_caption list\">\n";
  echo "<caption>" . get_vocab("server_details") . "</caption>\n";
  echo "<tr><td>" . get_vocab("database") . "</td><td>" . db()->version() . "</td></tr>\n";
  echo "<tr><td>" . get_vocab("system") . "</td><td>" . php_uname() . "</td></tr>\n";
  echo "<tr><td>" . get_vocab("servertime") . "</td><td>" .
       utf8_strftime($strftime_format['datetime'], time()) .
       "</td></tr>\n";
  echo "<tr><td>" . get_vocab("server_software") . "</td><td>" . htmlspecialchars(get_server_software()) . "</td></tr>\n";
  echo "<tr><td>PHP</td><td>" . phpversion() . "</td></tr>\n";
  echo "</table>\n";
}

echo "<p>\n" . get_vocab("browserlang") .":\n";

echo htmlspecialchars(implode(", ", array_keys(get_language_qualifiers())));

echo "\n</p>\n";

echo "<h3>" . get_vocab("help") . "</h3>\n";
echo "<p>\n";
echo get_vocab("please_contact") . '<a href="mailto:' . rawurlencode($mrbs_admin_email)
  . '">' . htmlspecialchars($mrbs_admin)
  . "</a> " . get_vocab("for_any_questions") . "\n";
echo "</p>\n";

require_once "site_faq/site_faq" . $faqfilelang . ".html";

output_trailer();

Original comment by: *anonymous

jberanek commented 5 years ago

No, go to help.php in your browser - follow the Help link in the header (Ajuda on your screenshot).

Original comment by: campbell-m

jberanek commented 5 years ago

關於MRBS Configuration details MRBS version MRBS 1.7.1 $auth['type'] db $auth['session'] php Server details 資料庫 MySQL 5.7.24 系統 Windows NT LAPTOP-BDLGPBLU 10.0 build 17763 (Windows 10) AMD64 Server time 2019/5/13 狟敁 06:05:52 Server software Apache/2.4.37 (Win64) PHP/5.6.40 PHP 5.6.40 你的瀏覽器設為: zh-TW, zh, en-US, en

Original comment by: *anonymous

jberanek commented 5 years ago

Thanks. You are getting Chinese characters in the calendars because your browser is set to Chinese. What I don't quite understand is why you are getting Spanish text.

What language do you want MRBS to be displayed in?

Original comment by: campbell-m

jberanek commented 5 years ago

This is an example of language detection working on the MRBS demo site, a Linux installation:

Original comment by: jberanek

jberanek commented 5 years ago

I mean what I don't quite understand is why you are getting Portuguese text (in your screenshot above).

Original comment by: campbell-m

jberanek commented 5 years ago

Ah, maybe this is the problem. Here are screenshots from the mini-calendars for (a) a Windows installation and (b) a Linux installation using exactly the same language preferences as yours. They are not the same as each other and neither of them are the same as your screenshot. Is this what you mean by "garbled"? Unfortunately I don't know enough about Chinese to know which, if any, is correct.

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/d5968e4fab/5c83/attachment/linux.PNG https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/d5968e4fab/5c83/attachment/windows.PNG

jberanek commented 5 years ago

Actually the Windows and Linux ones seem to be the same, except that the Windows one seems to have a longer version of the day name. This may just be a difference between the %a formats to strftime() on Windows and Linux. However they are both different from the original screenshot above.

Original comment by: campbell-m

jberanek commented 5 years ago

What have you got the following set to in your config file?

$strftime_format['dayname_cal']
$strftime_format['month_cal']

Original comment by: campbell-m

jberanek commented 5 years ago

Chinese

Original comment by: *anonymous

jberanek commented 5 years ago

As with the config.php file listed earlier, there are no such two variables. $strftime_format['dayname_cal'] $strftime_format['month_cal']

Original comment by: *anonymous

jberanek commented 5 years ago

This is also my doubt. I downloaded and installed from the website. I set up the database directly, which is garbled.

Original comment by: *anonymous

jberanek commented 5 years ago
<?php // -*-mode: PHP; coding:utf-8;-*-
namespace MRBS;
header("Content-Type:text/html; charset=utf-8");
/**************************************************************************
 *   MRBS Configuration File
 *   Configure this file for your site.
 *   You shouldn't have to modify anything outside this file.
 *
 *   This file has already been populated with the minimum set of configuration
 *   variables that you will need to change to get your system up and running.
 *   If you want to change any of the other settings in systemdefaults.inc.php
 *   or areadefaults.inc.php, then copy the relevant lines into this file
 *   and edit them here.   This file will override the default settings and
 *   when you upgrade to a new version of MRBS the config file is preserved.
 **************************************************************************/

/**********
 * Timezone
 **********/

// The timezone your meeting rooms run in. It is especially important
// to set this if you're using PHP 5 on Linux. In this configuration
// if you don't, meetings in a different DST than you are currently
// in are offset by the DST offset incorrectly.
//
// Note that timezones can be set on a per-area basis, so strictly speaking this
// setting should be in areadefaults.inc.php, but as it is so important to set
// the right timezone it is included here.
//
// When upgrading an existing installation, this should be set to the
// timezone the web server runs in.  See the INSTALL document for more information.
//
// A list of valid timezones can be found at http://php.net/manual/timezones.php
// The following line must be uncommented by removing the '//' at the beginning
$timezone = "Asia/Taipei";
//$timezone = ”Asia/Shanghai”;
//$timezone = "America/Anchorage";
/*******************
 * Database settings
 ******************/
// Which database system: "pgsql"=PostgreSQL, "mysql"=MySQL
$dbsys = "mysql";
// Hostname of database server. For pgsql, can use "" instead of localhost
// to use Unix Domain Sockets instead of TCP/IP. For mysql "localhost"
// tells the system to use Unix Domain Sockets, and $db_port will be ignored;
// if you want to force TCP connection you can use "127.0.0.1".
$db_host = "localhost";
// If you need to use a non standard port for the database connection you
// can uncomment the following line and specify the port number
// $db_port = 1234;
// Database name:
$db_database = "mrbs";
// Schema name.  This only applies to PostgreSQL and is only necessary if you have more
// than one schema in your database and also you are using the same MRBS table names in
// multiple schemas.
//$db_schema = "public";
// Database login user name:
$db_login = "root";
// Database login password:
$db_password = '123456';
// Prefix for table names.  This will allow multiple installations where only
// one database is available
$db_tbl_prefix = "mrbs_";
// Set $db_persist to TRUE to use PHP persistent (pooled) database connections.  Note
// that persistent connections are not recommended unless your system suffers significant
// performance problems without them.   They can cause problems with transactions and
// locks (see http://php.net/manual/en/features.persistent-connections.php) and although
// MRBS tries to avoid those problems, it is generally better not to use persistent
// connections if you can.
$db_persist = FALSE;
$auth["type"]="db";

/* Add lines from systemdefaults.inc.php and areadefaults.inc.php below here
   to change the default configuration. Do _NOT_ modify systemdefaults.inc.php
   or areadefaults.inc.php.  */

Original comment by: *anonymous

jberanek commented 5 years ago

Your picture is correct, but I can't display it.

Original comment by: *anonymous

jberanek commented 5 years ago

https://ithelp.ithome.com.tw/upload/images/20190514/20117510vLQkdb8fUr.jpg MYSQL encoding problems are also converted to UTF8

Original comment by: *anonymous

jberanek commented 5 years ago

Can you put the attached test program in your MRBS folder (at the same level as day.php) and let me know what the ouput is when you run it in your browser?

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/d5968e4fab/1abf/attachment/test.php

jberanek commented 5 years ago

// Formats used for dates and times. For formatting options // see http://php.net/manual/function.strftime.php $strftime_format['date'] = "%A %d %B %Y"; // Used in Day view $strftime_format['dayname'] = "%A"; // Used in Month view $strftime_format['dayname_edit'] = "%a"; // Used in edit_entry form $strftime_format['dayname_cal'] = "%a"; // Used in mini calendars $strftime_format['month_cal'] = "%B"; // Used in mini calendars $strftime_format['mon'] = "%b"; // Used in date selectors $strftime_format['ampm'] = "%p"; $strftime_format['time12'] = "%I:%M%p"; // 12 hour clock $strftime_format['time24'] = "%H:%M"; // 24 hour clock $strftime_format['datetime'] = "%c"; // Used in Help $strftime_format['datetime12'] = "%I:%M%p - %A %d %B %Y"; // 12 hour clock $strftime_format['datetime24'] = "%H:%M - %A %d %B %Y"; // 24 hour clock

Change the variable to systemdefaults.inc.php

Original comment by: *anonymous

jberanek commented 5 years ago

test.php The result is the same garbled https://ithelp.ithome.com.tw/upload/images/20190514/20117510sy7qKXnehM.jpg

Original comment by: *anonymous

jberanek commented 5 years ago

Thanks. Here's another version of test.php. Can you try it again please and let me know the output under "Encodings".

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/d5968e4fab/4738/attachment/test.php

jberanek commented 5 years ago

https://ithelp.ithome.com.tw/upload/images/20190514/20117510gEy5OJCBAX.jpg

Original comment by: *anonymous

jberanek commented 5 years ago

Encodings The string seems to be compatible with EUC-CN The string seems to be compatible with HZ The string seems to be compatible with GBK The string seems to be compatible with CP936 The string seems to be compatible with GB18030 The string seems to be compatible with EUC-TW The string seems to be compatible with BIG5 The string seems to be compatible with CP950 Not compatible with BIG5-HKSCS Not compatible with BIG5-HKSCS:2004 Not compatible with BIG5-HKSCS:2001 Not compatible with BIG5-HKSCS:1999 Not compatible with ISO-2022-CN Not compatible with ISO-2022-CN-EXT

Original comment by: *anonymous

jberanek commented 5 years ago

Thanks. Here is one more test please. Could you let me know what it says under Encodings and also Locale?

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/d5968e4fab/1492/attachment/test.php

jberanek commented 5 years ago

Locale Chinese_Taiwan.936

Original comment by: *anonymous

jberanek commented 5 years ago

Thanks. Here is another test. What does Test 4 say?

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/d5968e4fab/858d/attachment/test.php

jberanek commented 5 years ago

Test 4 週日 週一 週二 週三 週四 週五 週六

Original comment by: *anonymous

jberanek commented 5 years ago

And is Test 4 what you would expect to see in the calendars? In other words it is correct?

Original comment by: campbell-m

jberanek commented 5 years ago

YES

Original comment by: *anonymous

jberanek commented 5 years ago

OK. The problem seems to be that your system is using Windows Codepage 936 instead of 950. I'll need to think about this.

Original comment by: campbell-m

jberanek commented 5 years ago

When you say "the database is garbled" what do you mean? Do you mean that phpMyAdmin is displaying garbled characters?

Original comment by: campbell-m

jberanek commented 5 years ago

Not my database is normal

Original comment by: *anonymous

jberanek commented 5 years ago

I mean the format is changed to UTF-8

Original comment by: *anonymous

jberanek commented 5 years ago

Try setting in your config file:

$override_locale = 'chs';

Original comment by: campbell-m

jberanek commented 5 years ago

It is correct, thank you

Original comment by: *anonymous