Ticket #1484591 (closed Bugs: duplicate)

Opened 14 months ago

Last modified 14 months ago

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

Changed 14 months ago by thomasb

  • status changed from new to closed
  • resolution set to duplicate

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.

Changed 14 months 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.