Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1484591 closed Bugs (duplicate)

rep_specialchars_output() function may destroy UTF8 encoded text

Reported by: Neck Owned by:
Priority: 5 Milestone:
Component: Client Scripts Version: 0.1-rc1
Severity: normal Keywords:
Cc:

Description

in rep_specialchars_output()

the following code applies:

// convert nbsps back to normal spaces if not html
if ($enctype!='html')
  $str = str_replace(chr(160), ' ', $str);

This might break UTF8 encoding since chr() return the correponding char in PHP's core's encoding which is iso.
At least it was breaking all ajax answer on my server.

I corrected that part with:

// convert nbsps back to normal spaces if not html
if ($enctype!='html') {
  $nbsp = rcube_charset_convert(chr(160), 'ISO-8859-1', $OUTPUT->get_charset());
  $str = str_replace($nbsp, ' ', $str);
}

Hope this help.

NB: it wouldnt work with php6 since core's encoding has been changed to UTF8.

Change History (2)

comment:1 Changed 6 years ago by thomasb

  • Resolution set to duplicate
  • Status changed from new to closed

This is already fixed. Dupe of #1484429

Once again: please test with the latest SVN checkout and check for similar bugs before opening a new ticket.

comment:2 Changed 6 years ago by Neck

Sorry, did about 10 queries on tickets with keywords like "question mark utf8 ajax" and didnt find that one.

Note: See TracTickets for help on using tickets.