Page 1 of 1

HESK22 truncates messages starting on a special character

Posted: Sat Jan 22, 2011 6:58 pm
by majullian
Script URL:
Version of script: 22
Hosting company: Local installation on Open SuSE 11.3 within our VPN
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Accents, Truncates, Spanish, Espanol

Write your message below:
Hello and thanks in advanced for the time anyone invests in replying to this thread, I really appreciate any help provided, now, the issue is the following, I have a local installation of an Open SuSE 11.3 and I have the following versions of software:

-- Apache 2.2.15
-- MySQL 5.1.46-log
-- PHP 5.3.2 (I have the phpinfo output but I dont see a way to attach it, I can send it via e-mail or PM or something though)
-- PHPMyAdmin 3.3.9
-- Spanish language pack (downloaded from http://www.hesk.com/languages/22/es.zip)

So the situation is the following, I have hesk installed and everything went smoothly during installation and I have even done some adjustments to the templates to fit our needs, everything works just fine, e-mails, tickets, replies etc... but.... here is the but.. hehe, since we are using the Spanish language pack we are expecting for our clients to be able to use special charcaters like " áéíóú " and " ñ " so at the beggining I didn´t pay too much attention assuming that it would work just fine and actually the e-mails that the system sends get to my inbox perfectly fine even with the special characters.... so up to this point everything seems to still be correct but here is the thing, any message or text that you input in any form field and that it has a special character on it, the system or the DB or something truncates it up to the point where the first special character appears.

Example:

--- I´m sending a new ticket and I´m typing the subject and the message and I type
... as the subject: "Esto es una prueba áéíóú y ñ y aun mas texto"
... as the message: "Esto es una prueba áéíóú y ñ y aun mas texto"

So the database only registers in both fields: "Esto es una prueba " without the quotes of course so for some reason no matter the part of the system we are at, if we enter any special character, the system doesn´t seem to process it and truncates the string at that point and that´s what the DB gets.

Or probably is the Database what is truncating the message.

In any case, any help is very much appreciated and again, I can send the phpinfo output or any other output via e-mail or something.

Thank you all for your help
Marco Sanchez

Re: HESK22 truncates messages starting on a special characte

Posted: Sat Jan 22, 2011 7:53 pm
by Klemen
Hi,

I just ran the same test on the demo help desk and it worked fine:
http://www.hesk.com/demo/ticket.php?track=GXZ2Q1WB6N

This means the problem is a setting on the server. What is it? I am not sure.

Try this to see if the special chars are even sent to the database:
1. open "submit_ticket.php" in Notepad
2. find this code

Code: Select all

$sql = "
INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` (
3. just ABOVE that code paste this:

Code: Select all

echo "<br />DEBUG 1: " . $tmpvar['subject'] . "<br />";
4. scroll further down the file and find

Code: Select all

$ticket = array(
5. again, just ABOVE this code paste this:

Code: Select all

echo "<br />DEBUG 2: " . $sql . "<br />";
6. Save changes, upload to server and submit a ticket.

Let me know what message you say after submitting the ticket.

Re: HESK22 truncates messages starting on a special characte

Posted: Mon Jan 24, 2011 3:25 pm
by majullian
Hello Klemen, thank you so much for replying that fast and indeed I know it is not a problem of the software, it must be something related to the Database most likely or something, here is the output after having sent a ticket as you requested it:


DEBUG 1: Tema con acentos áéíóú y mas letras

DEBUG 2: INSERT INTO `hesk_tickets` ( `trackid`,`name`,`email`,`category`,`priority`,`subject`,`message`,`dt`,`lastchange`,`ip`,`status`,`attachments`,`history`,`custom1`,`custom2`,`custom3`,`custom4`,`custom5`,`custom6`,`custom7`,`custom8`,`custom9`,`custom10`,`custom11`,`custom12`,`custom13`,`custom14`,`custom15`,`custom16`,`custom17`,`custom18`,`custom19`,`custom20` ) VALUES ( 'TDJP3A685N', 'marco', 'marco.sanchez@ggmgasolineras.com', '14', '3', 'Tema con acentos áéíóú y mas letras', 'Tema con acentos áéíóú y mas letras', NOW(), NOW(), '192.168.201.3', '0', '', '', 'TARANGO', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' )


Thanks again for all your help man :)

Re: HESK22 truncates messages starting on a special characte

Posted: Mon Jan 24, 2011 3:54 pm
by majullian
Hello again Klemen, some additional info, I´ve been reading about the DB charsets and encoding and I thought I knew a some things about it but it seems that that is a very big topic so anyway, I made this charset extractor script:

Code: Select all

<?php
$link    = mysql_connect('localhost', 'helpdesk', '[password]');
$base= mysql_selectdb('helpdesk',$link);
$charset = mysql_client_encoding($link);

echo "Print 1 if the Database exists or leave blank if it doesnt:";
echo "<br />";
echo "$base";
echo "<br />";
echo "The current character set is:";
echo "<br />";
echo "$charset";
?>

And the results are:
------------------------------
Print 1 if the Database exists or leave blank if it doesnt:
1
The current character set is:
utf8
------------------------------

So in this case I honestly don´t know where to look hehe, I mean, I´ll keep searching the Internet....

I´ll wait for your reply and thanks again
Marco

Re: HESK22 truncates messages starting on a special characte

Posted: Mon Jan 24, 2011 5:36 pm
by majullian
Hello Klemen, I made it work, I mean, probably it wasn´t like the best way to do it but a workaround but it worked hehe

What I did was simply changing the char set of the text.php file within the "es" (for spanish) language and then make a massive search and replace of every á for &aacute; and every é for &eacute; and so on, including the letter ñ and I did that for the text.php and all the email´s files.

Now everything is working as expected, the database gets the correct characters, the webpages show everything just fine and the e-mails come in correctly as well so from now on, just happiness.

Thank you for your original reply and if by any chance you know like the best way to fix it I´d really appreciate, although right now I have the Spanish folder ready for utf8 and if I installed it somewhere else I can simply copy and ´paste. hehe Nice

Marco

Re: HESK22 truncates messages starting on a special characte

Posted: Tue Jan 25, 2011 6:11 pm
by Klemen
From the test you posted the problem must be saving data to the database.

But if your work-around works for you, you know what they say: don't fix if it ain't broken :wink: