kalkun-sms / Kalkun

Open Source Web based SMS Manager
https://kalkun.sourceforge.io/
GNU General Public License v2.0
209 stars 129 forks source link

Cannot see or send Norwegian/Danish characters #88

Closed gunleik closed 11 years ago

gunleik commented 11 years ago

I have set up Kalkun with XAMPP on Windows. I have set the DB to be UTF-8, the ODBC connection to use UTF-8, but the norwegian/danish letters æ ø and å will not be sent - and it is showed in wrong character set in the message view. I have tried altering the character set in config.php, db and odbc to iso-8859-1 (and others). Sometimes i might get some of the letters, but never all.

Any ideas?

gunleik commented 11 years ago

Bummer - thought about it just after posting, the gammucoding in gammu's smsdrc was not set to utf8. Now it works at least for the sending. For viewing sent items in the message list it is still wrong character set.

kingster commented 11 years ago

Old ones will not change. See if u still face the problem on new incoming messages.

gunleik commented 11 years ago

Yes, the message view of new messages in inbox or sent items still is garbled (wrong character set). When it comes to outgoing messages I can see the norwegian characters as long as the message reside in the outbox, but after it have been processed by gammu the charachters become garbled. And useing phpmyadmin on the db also looks like the text there is garbled. So I guess it is gammu that updates the db with some character set error.

back2arie commented 11 years ago

Hi

Why not using the unicode?

gunleik commented 11 years ago

I does not help to tick the unicode checkbox when creating a message. It seems that it is gammu who alter the message content between the outbox and sentitems - and at sentitems it will not show correctly in kalkun.

back2arie commented 11 years ago

@gunleik any update on this issue?

Did you tried it directly using gammu?

gunleik commented 11 years ago

Sending a message with command line to gammu works fine. To me it seems that the problem goes like this. I post message with Kalkun. Kalkun store message to mysql table (not utf-8 encoded). Gammu reads the post in outbox, sends the message and saves it back to sentitems as utf8-encoded. For some reason (might be some miscofiguration by me), Kalkun/browser does not properly decode the utf8 format.

I have done the following manual alterations to the code as an easy fix:


diff message_list.php-ORG message_list.php
48c48
<       <div title="<?php echo $tmp->TextDecoded?>" class="messagelist <?php  if($type == 'inbox' && $tmp->readed=='false') echo "unreaded";?>">
---
>       <div title="<?php echo utf8_decode($tmp->TextDecoded)?>" class="messagelist <?php  if($type == 'inbox' && $tmp->readed=='false') echo "unreaded";?>">
63c63
<               <span class="message_preview" <?php  if($type == 'inbox' && $tmp->readed=='false') echo "style=\"font-weight: bold\"";?>>-&nbsp;<?php echo message_preview($tmp->TextDecoded, $char_per_line);?></span>
---
>               <span class="message_preview" <?php  if($type == 'inbox' && $tmp->readed=='false') echo "style=\"font-weight: bold\"";?>>-&nbsp;<?php echo utf8_decode(message_preview($tmp->TextDecoded, $char_per_line));?></span>

diff conversation.php-ORG conversation.php
51c51
<       <span class="message_preview">-&nbsp;<?php echo message_preview($tmp['TextDecoded'], $char_per_line);?></span>
---
>       <span class="message_preview">-&nbsp;<?php echo utf8_decode(message_preview($tmp['TextDecoded'], $char_per_line));?></span>
129c129
<       <?php echo "<div class=\"message_content hidden\" style=\"padding: 5px 10px 5px 20px\">".showmsg($tmp['TextDecoded'])."</div>";?>
---
>       <?php echo "<div class=\"message_content hidden\" style=\"padding: 5px 10px 5px 20px\">".utf8_decode(showmsg($tmp['TextDecoded']))."</div>";?>
back2arie commented 11 years ago

Did you try to change Encoding setting on your browser?

gunleik commented 11 years ago

Yes I did try manually setting the encoding, but to no use. I don't remember if I tried other browsers (maybe only tried in Chrome). I did get my solution with utf8_decode as mentioned, so if no one else have problem with with their special characters we can let the case rest. But if someone else have the problem, please tell and I can do some more research on my side.