← Back to team overview

mahara-contributors team mailing list archive

[Bug 1613392] Re: PostgreSQL insert error into site_content with multibyte language packs.

 

Are you using custom lang files? And if so, would you mind attaching the
lang/ja.utf8/install.php file here for testing?

>From that error stack, it looks like it was trying to insert this block
of text:

<h1>Maharaにようこそ</h1>
<p>[<b>あなたの組織名</b>]はオンラインコミュニティを構築するための十分な機能を有するインターネット上のポートフォリオシステムです。</p>
<p>Maharaに関する詳細は<ahref='about.php'>About</a>[このページを忘れずに編集してください]をお読みください。また、私たちに<ahref='contact.php'>お気軽にお問い合わせください</a>。</p>
<p>あなたはこのテキストを膧編集することができます。</p>

... which looks like a modified version of the
"loggedouthomedefaultcontent" string. (Although, I tried pasting that
into my langpack, and it still ran without any problems. Maybe it got
converted at some point during my copying and pasting.)

If you are using custom lang files, could you try setting their encoding
the lang files themselves to UTF-8?

Cheers,
Aaron

** Changed in: mahara
       Status: In Progress => Incomplete

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1613392

Title:
  PostgreSQL insert error into site_content with multibyte language
  packs.

Status in Mahara:
  Incomplete

Bug description:
  When we try to add a new institution using Japanese language menu, we
  have an error message "Mahara: Site unavailable A nonrecoverable error
  occurred. This probably means you have encountered a bug in the
  system" and can't add the institution.

  And Apache error log says as below:
  [error] [client xxx.xxx.xxx.xxx] [WAR] 18 (lib/errors.php:820) HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".] in adodb_throw(INSERT INTO "site_content" ("name", "content", "ctime", "mtime", "institution") VALUES (?, ?, ?, ?, ?), home,<h1>Mahara\xe3\x81\xab\xe3\x82\x88\xe3\x81\x86\xe3\x81\x93\xe3\x81\x9d</h1><p>[<b>\xe3\x81\x82\xe3\x81\xaa\xe3\x81\x9f\xe3\x81\xae\xe7\xb5\x84\xe7\xb9\x94\xe5\x90\x8d</b>]\xe3\x81\xaf\xe3\x82\xaa\xe3\x83\xb3\xe3\x83\xa9\xe3\x82\xa4\xe3\x83\xb3\xe3\x82\xb3\xe3\x83\x9f\xe3\x83\xa5\xe3\x83\x8b\xe3\x83\x86\xe3\x82\xa3\xe3\x82\x92\xe6\xa7\x8b\xe7\xaf\x89\xe3\x81\x99\xe3\x82\x8b\xe3\x81\x9f\xe3\x82\x81\xe3\x81\xae\xe5\x8d\x81\xe5\x88\x86\xe3\x81\xaa\xe6\xa9\x9f\xe8\x83\xbd\xe3\x82\x92\xe6\x9c\x89\xe3\x81\x99\xe3\x82\x8b\xe3\x82\xa4\xe3\x83\xb3\xe3\x82\xbf\xe3\x83\xbc\xe3\x83\x8d\xe3\x83\x83\xe3\x83\x88\xe4\xb8\x8a\xe3\x81\xae\xe3\x83\x9d\xe3\x83\xbc\xe3\x83\x88\xe3\x83\x95\xe3\x82\xa9\xe3\x83\xaa\xe3\x82\xaa\xe3\x82\xb7\xe3\x82\xb9\xe3\x83\x86\xe3\x83\xa0\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82</p><p>Mahara\xe3\x81\xab\xe9\x96\xa2\xe3\x81\x99\xe3\x82\x8b\xe8\xa9\xb3\xe7\xb4\xb0\xe3\x81\xaf<ahref="about.php">About</a>[\xe3\x81\x93\xe3\x81\xae\xe3\x83\x9a\xe3\x83\xbc\xe3\x82\xb8\xe3\x82\x92\xe5\xbf\x98\xe3\x82\x8c\xe3\x81\x9a\xe3\x81\xab\xe7\xb7\xa8\xe9\x9b\x86\xe3\x81\x97\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84]\xe3\x82\x92\xe3\x81\x8a\xe8\xaa\xad\xe3\x81\xbf\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84\xe3\x80\x82\xe3\x81\xbe\xe3\x81\x9f\xe3\x80\x81\xe7\xa7\x81\xe3\x81\x9f\xe3\x81\xa1\xe3\x81\xab<ahref="contact.php">\xe3\x81\x8a\xe6\xb0\x97\xe8\xbb\xbd\xe3\x81\xab\xe3\x81\x8a\xe5\x95\x8f\xe3\x81\x84\xe5\x90\x88\xe3\x82\x8f\xe3\x81\x9b\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84</a>\xe3\x80\x82</p><p>\xe3\x81\x82\xe3\x81\xaa\xe3\x81\x9f\xe3\x81\xaf\xe3\x81\x93\xe3\x81\xae\xe3\x83\x86\xe3\x82\xad\xe3\x82\xb9\xe3\x83\x88\xe3\x82\x92\x81\xa7\xe7\xb7\xa8\xe9\x9b\x86\xe3\x81\x99\xe3\x82\x8b\xe3\x81\x93\xe3\x81\xa8\xe3\x81\x8c\xe3\x81\xa7\xe3\x81\x8d\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82</p>,2016-08-1512:50:39,2016-08-1512:50:39,inst), referer: https://mahara.xxxxx.com/admin/users/institutions.php

  To avoid this error, I would like to recommend to modify lib/dml.php
  as below.

  File:
  lib/dml.php

  Line:
  1061

  [ Before ]
    // Pull out data matching these fields
      $ddd = array();
      foreach ($columns as $column) {
          if (isset($data[$column->name])) {
              if ($column->name == $primarykey && empty($setfromseq)) {
                  continue;
              }
              $ddd[$column->name] = $data[$column->name];
          }
      }

  [ After ]
    // Pull out data matching these fields
      $ddd = array();
      foreach ($columns as $column) {
          if (isset($data[$column->name])) {
              if ($column->name == $primarykey && empty($setfromseq)) {
                  continue;
              }
              if (function_exists('mb_convert_encoding')) {
                  $ddd[$column->name] = mb_convert_encoding($data[$column->name], "UTF-8", "auto");
              } else {
                  $ddd[$column->name] = $data[$column->name];
             }
          }
      }

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1613392/+subscriptions


References