1
carlos1426
AMS 2.51 Can't show spanish characters
  • 2009/9/11 18:10

  • carlos1426

  • Just popping in

  • Posts: 38

  • Since: 2004/5/18


Hi.

I'd installed XOOPS 2.3.3 in my local server for test purposes. I'd installed english version, and then upload spanish translation folder to the adecuate folders.

I'm using Uniform Server 5.0.41.
I'd configure Uniserver's MySql to use utf8.
The Uniserver's MySql informatio_schema DB is utf8_general_ci.
I'd configured Uniserver's MySql to use connection collation: utf8_spanish_ci.
I'd created XOOPS DB installation with utf8_spanish_ci collation.

The proble arise with AMS module when I try to input an Article Title with a spanish character like an accented letter. The content is saved only to the char previous to offending char

Ex.: "GestiĆ³n" is saved as "Gesti"

Can anyone help me?

2
ghia
Re: AMS 2.51 Can't show spanish characters
  • 2009/9/11 19:44

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Best is to have your XOOPS tables with utf8_spanish_ci collation.
Check that character set in mainfile.php is set to utf8 and also UTF-8 is selected in /language/spanish/global.php
Verify that all language, template, script and theme files are in UTF-8 format without BOM. Use an appropriate editor to as Notepad++ to convert.

3
carlos1426
Re: AMS 2.51 Can't show spanish characters
  • 2009/9/12 11:59

  • carlos1426

  • Just popping in

  • Posts: 38

  • Since: 2004/5/18


Thank you.

All XOOPS tables are in utf8_spanish_ci collation. I tested some AMS tables and the string fields are in utf8_spanish_ci collation too.

I'd tried this, but it didn't worked. I changed this
define('_CHARSET','ISO-8859-1');
to this
define('_CHARSET','UTF-8');
in language/spanish/global.php

With this change, the home page looks fine, but when I select any option in Main Menu(linked to /modules/...), the spanish texts in the screen looks with extrange characters, but the AMS table store the spanis characters correctly.

If I revert the changes in global.php, all spanish texts in XOOPS looks fine, but AMS doesn't store spanish characters.

Do you know another item to look for?

Thank you again

4
ghia
Re: AMS 2.51 Can't show spanish characters
  • 2009/9/12 14:34

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Is the html source of your site also indicating UTF-8?
Is there a link where we can see this?

5
carlos1426
Re: AMS 2.51 Can't show spanish characters
  • 2009/9/20 16:55

  • carlos1426

  • Just popping in

  • Posts: 38

  • Since: 2004/5/18


Sorry for the delay in my answer. I was on journey last 10 days.

The problem persists. Thre's no "UTF-8" in the html source as far as in global.php there is a "ISO-8859-1" defined as charset.

I'm doing tests in a local server. Thre's no option to say it on line. Down is part of the html source

Thank you.

***************************************************
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<!-- Title and meta -->
<meta http-equiv="content-language" content="es" />
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>XOOPS Site</title>

<meta name="author" content="The XOOPS Project" />
<meta name="generator" content="XOOPS" />

<link rel="shortcut icon" type="image/ico" href="http://localhost/favicon.ico" />
<link rel="stylesheet" type="text/css" media="all" title="Style sheet" href="http://localhost/xoops.css" />
<link rel="stylesheet" type="text/css" media="all" title="Style sheet" href="http://localhost/modules/system/class/gui/exm/css/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="http://localhost/language/spanish/style.css" />
<script type="text/javascript" src="http://localhost/include/xoops.js"></script>
<script type="text/javascript"><!--//--><![CDATA[//><!--
startList = function() {
if (document.all&&document.getElementById) {

6
ghia
Re: AMS 2.51 Can't show spanish characters
  • 2009/9/20 21:34

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You must get your site in line with your database and since it is in UTF-8 all the other things need to be also.
-connection in mainfile.php
-char set in global.php
If the fixed texts of XOOPS display in error, this means you need also to have your language files (inc templates themes and some js) in UTF-8 format in stead of the regular ansi. Conversion from ansi to UTF-8 without BOM(!) can be done with an appropriate editor as eg NotePad++.

7
wishcraft
Re: AMS 2.51 Can't show spanish characters

There is also another technic ghia for unicode and UTF character sets you can use if you are with the later version of XOOPS 2.4.0 the following field types in the class:

Quote:

XOBJ_DTYPE_UNICODE_TXTBOX
XOBJ_DTYPE_UNICODE_TXTAREA
XOBJ_DTYPE_UNICODE_URL
XOBJ_DTYPE_UNICODE_EMAIL
XOBJ_DTYPE_UNICODE_ARRAY
XOBJ_DTYPE_UNICODE_OTHER


Infact these field types have been included cause not all UTF online is UTF8 there is also UTF16 and UTF32 as well as unicode. With these field types you can for example in a forum have mixed language content thats is a thread which has one entry in spanish the next one in chinese and the last in zulu.

To change these around to this you have to make the change in your class constructor.. For example:

*** Old Class ***
<?php
// $Autho: wishcraft $

if (!defined('XOOPS_ROOT_PATH')) {
    exit();
}
/**
 * Class for compunds
 * @author Simon Roberts <simon@xoops.org>
 * @copyright copyright (c) 2009-2003 XOOPS.org
 * @package kernel
 */
class VidshopVideo_category extends XoopsObject
{

    function 
VidshopVideo_category($id null)
    {
        
$this->initVar('cid'XOBJ_DTYPE_INTnullfalse);
        
$this->initVar('weight'XOBJ_DTYPE_INT1false);
        
$this->initVar('name'XOBJ_DTYPE_TXTBOXnulltrue128);
        
$this->initVar('image'XOBJ_DTYPE_OTHERnullfalse255);
        
$this->initVar('description'XOBJ_DTYPE_OTHERnullfalse);        
    }

}


/**
* XOOPS policies handler class.
* This class is responsible for providing data access mechanisms to the data source
* of XOOPS user class objects.
*
* @author  Simon Roberts <simon@chronolabs.org.au>
* @package kernel
*/
class VidshopVideo_categoryHandler extends XoopsPersistableObjectHandler
{
    function 
__construct(&$db
    {
        
$this->db $db;
        
parent::__construct($db"vidshop_video_category"'VidshopVideo_category'"cid""name");
    }
}

?>


You would change this to this to support any form of language regardless of the database support.

<?php
// $Autho: wishcraft $

if (!defined('XOOPS_ROOT_PATH')) {
    exit();
}
/**
 * Class for compunds
 * @author Simon Roberts <simon@xoops.org>
 * @copyright copyright (c) 2009-2003 XOOPS.org
 * @package kernel
 */
class VidshopVideo_category extends XoopsObject
{

    function 
VidshopVideo_category($id null)
    {
        
$this->initVar('cid'XOBJ_DTYPE_INTnullfalse);
        
$this->initVar('weight'XOBJ_DTYPE_INT1false);
        
$this->initVar('name'XOBJ_DTYPE_UNICODE_TXTBOXnulltrue128);
        
$this->initVar('image'XOBJ_DTYPE_OTHERnullfalse255);
        
$this->initVar('description'XOBJ_DTYPE_UNICODE_OTHERnullfalse);        
    }

}


/**
* XOOPS policies handler class.
* This class is responsible for providing data access mechanisms to the data source
* of XOOPS user class objects.
*
* @author  Simon Roberts <simon@chronolabs.org.au>
* @package kernel
*/
class VidshopVideo_categoryHandler extends XoopsPersistableObjectHandler
{
    function 
__construct(&$db
    {
        
$this->db $db;
        
parent::__construct($db"vidshop_video_category"'VidshopVideo_category'"cid""name");
    }
}

?>


This is being introduced for multiple types of database services in 2.5 as not all of them even have UTF support and MySQL is quiet limited. btw. Zulu is UTF-16 for example which MySQL doesn't support, but using this method it can still store the escaped 16 bits of data and display using the handling for it in object.php

8
carlos1426
Re: AMS 2.51 Can't show spanish characters
  • 2009/9/21 16:56

  • carlos1426

  • Just popping in

  • Posts: 38

  • Since: 2004/5/18


Thank you for your answer. I'll try it.

Thank you again.

Login

Who's Online

59 user(s) are online (43 user(s) are browsing Support Forums)


Members: 0


Guests: 59


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits