Error: when user use umlaut or apostrophe in text
« on: February 10, 2014, 11:41:26 AM »
If users write a message and use an umlaut or apostrophe in the text ........... the text is cut of when the send it. How can I fix this?

*

CBG

  • *****
  • 673
    • osDate Forum
Re: Error: when user use umlaut or apostrophe in text
« Reply #1 on: February 10, 2014, 12:17:08 PM »
What version of osDate?
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

Re: Error: when user use umlaut or apostrophe in text
« Reply #2 on: February 10, 2014, 07:02:57 PM »
Sorry.  osDate 2.6

Any idea?

*

CBG

  • *****
  • 673
    • osDate Forum
Re: Error: when user use umlaut or apostrophe in text
« Reply #3 on: February 10, 2014, 07:17:19 PM »
So what you add a ' it cuts off the rest of the message.

Can you try this doing this \' instead of a '
Then let me know the results.

If it what I think it is, it needs the \ as an escape method, or the PHP see ' and stop processing the rest.
« Last Edit: February 10, 2014, 07:19:27 PM by CBG »
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

Re: Error: when user use umlaut or apostrophe in text
« Reply #4 on: February 10, 2014, 07:32:48 PM »
Thanx, you are right! when I use \' it works fine. But it cuts also with geïnteresseerd . ge \ ïnteresseerd   doesn't solve the problem. Please advice

*

CBG

  • *****
  • 673
    • osDate Forum
Re: Error: when user use umlaut or apostrophe in text
« Reply #5 on: February 10, 2014, 07:36:48 PM »
I think I know how to fix it, but need to test it and that won't be till tomorrow, as I got some stuff on today.

There is a couple of ways to fix this
1. Get PHP to add the \ then remove it when displaying
2. Change the ' into HTML code

As for the Umlaut, I will have to look at another way for that, but am thinking a similar way as the '
 
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

CBG

  • *****
  • 673
    • osDate Forum
Re: Error: when user use umlaut or apostrophe in text
« Reply #6 on: February 11, 2014, 04:37:16 PM »
Hi,

I think I have got it working, here are the steps I did.

Step 1
Backup everything, just in case.


Step 2
Open all language files you use and set the Encoding to utf-8.
Like
Code: [Select]
$lang['ENCODING'] = 'utf-8';


Step 3
Login into the osDate admin and re-load the editted languages


Step 4
Open compose.php

Find
Code: [Select]
$time001 = time();

Add after
Code: [Select]
$msg = $_POST["txtmessage"];
$msg = str_replace("'", ''', $msg);
$von = array("ä","ö","ü","ß","Ä","Ö","Ü"," ","é");
$zu  = array("ä","ö","ü","ß","Ä","Ö","Ü"," ","é"); 
$msg = str_replace($von, $zu, $msg);

Find:
Code: [Select]
$osDB->query( 'INSERT INTO ! (owner, senderid, recipientid, subject, message, sendtime, folder, notifysender) values(?, ?, ?, ?, ?, ?, ?, ?)', array( MAILBOX_TABLE, $_POST['txtrecipient'], $_SESSION['UserId'], $_POST['txtrecipient'], stripEmails(strip_tags($_POST['txtsubject'])), stripEmails($_POST['txtmessage']), $time001, 'inbox', ($_POST["chknotify"] - 0) ) );
[code]

Change to:
[code]
$osDB->query( 'INSERT INTO ! (owner, senderid, recipientid, subject, message, sendtime, folder, notifysender) values(?, ?, ?, ?, ?, ?, ?, ?)', array( MAILBOX_TABLE, $_POST['txtrecipient'], $_SESSION['UserId'], $_POST['txtrecipient'], stripEmails(strip_tags($_POST['txtsubject'])), stripEmails($msg), $time001, 'inbox', ($_POST["chknotify"] - 0) ) );

Find:
Code: [Select]
$osDB->query( 'INSERT INTO ! (owner, senderid, recipientid, subject, message, sendtime, folder) values(?, ?, ?, ?, ?, ?, ?)', array( MAILBOX_TABLE, $_SESSION['UserId'], $_SESSION['UserId'], $_POST['txtrecipient'], stripEmails(strip_tags($_POST['txtsubject'])), stripEmails($_POST['txtmessage']), $time001, 'sent' ) );

Change to:
Code: [Select]
$osDB->query( 'INSERT INTO ! (owner, senderid, recipientid, subject, message, sendtime, folder) values(?, ?, ?, ?, ?, ?, ?)', array( MAILBOX_TABLE, $_SESSION['UserId'], $_SESSION['UserId'], $_POST['txtrecipient'], stripEmails(strip_tags($_POST['txtsubject'])), stripEmails($msg), $time001, 'sent' ) );


Step 5
Test


Notes
Step 2 and 3 are really important or it won't work.


It currently supports
' / ä / ö  / ü / ß / Ä / Ö / Ü / é
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

Re: Error: when user use umlaut or apostrophe in text
« Reply #7 on: February 12, 2014, 10:41:39 AM »
I add Ï and know it works perfect. Many thanx

Re: Error: when user use umlaut or apostrophe in text
« Reply #8 on: October 25, 2014, 12:26:59 PM »
Hi.

E-mail going out the accented characters appear to me wrongly in a message. I use a Hungarian language on the web page utf-with 8 character codings. With the codes written down here made construct the compose.php his content but no change happened so. If something would be somebody's idea I would say thanks for it. Greet too. I wish everybody an additional beautiful day.

Re: Error: when user use umlaut or apostrophe in text
« Reply #9 on: October 28, 2014, 12:09:15 PM »
I managed to solve the problem. :)