[wp-trac] [WordPress Trac] #19448: Encoding errors in AJAX responces

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 7 10:36:26 UTC 2012


#19448: Encoding errors in AJAX responces
-------------------------------------+-------------------------------------
 Reporter:  sergey.s.betke@…         |       Owner:  sergey.s.betke@…
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  3.5
Component:  Administration           |     Version:  3.2.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch dev-feedback   |
-------------------------------------+-------------------------------------
Changes (by SergeyBiryukov):

 * milestone:  Awaiting Review => 3.5


Comment:

 Another way to reproduce (from #10817):

 1. Set `default_charset` parameter in php.ini to `'iso-8859-2'`.
 2. Make sure the blog charset in Settings → Reading is UTF-8.
 3. Go to Posts → Categories, create a new category: "Árvíztűrő
 tükörfúrógép".
 4. The AJAX response is wrong: [attachment:19448.response.png].
 5. If `default_charset` is set to `'windows-1251'`, the response doesn't
 appear at all due to an error:
 {{{
 Timestamp: 07.08.2012 14:16:41
 Error: not well-formed
 Source File: http://trunk.wordpress/wp-admin/admin-ajax.php
 Line: 1, Column: 903
 Source Code:
 <?xml version='1.0' standalone='yes'?><wp_ajax><response action='add-
 tag_0'><taxonomy id='0'
 position='1'><response_data><![CDATA[]]></response_data><supplemental><parents><![CDATA[<tr
 id="tag-149"><th scope="row" class="check-column"><label class="screen-
 reader-text" for="cb-select-149">Select ГЃrvГ­ztЕ±rЕ‘
 tükörfúrógép</label><input type="checkbox" name="delete_tags[]"
 value="149" id="cb-select-149" /></th><td class='name column-
 name'><strong><a class="row-title" href="http://trunk.wordpress/wp-admin
 /edit-
 tags.php?action=edit&#038;taxonomy=category&#038;tag_ID=149&#038;post_type=post"
 title="Редактировать &laquo;Árvíztűrő
 tükörfúrógép&raquo;">Árvíztűrő tükörfúrógép</a></strong><br
 /><div class="row-actions"><span class='edit'><a
 href="http://trunk.wordpress/wp-admin/edit-
 tags.php?action=edit&#038;taxonomy=category&#038;tag_ID=149&#038;post_type=post">Р￿зменить</a>
 | </span><span class='inline hide-if-no-js'><a href="#"
 class="editinline">Свойства</a> | </span><span class='delete'><a
 class='delete-tag' href='edit-
 tags.php?action=delete&amp;taxonomy=category&amp;tag_ID=149&amp;_wpnonce=23ee944760'>Удалить</a>
 | </span><span class='view'><a href="http://trunk.wordpress/category
 /arvizturo-tukorfurogep/">Перейти</a></span></div><div
 class="hidden" id="inline_149"><div class="name">ГЃrvГ­ztЕ±rЕ‘
 tükörfúrógép</div><div class="slug">arvizturo-tukorfurogep</div><div
 class="parent">0</div></div></td><td class='description column-
 description'></td><td class='slug column-slug'>arvizturo-
 tukorfurogep</td><td class='posts column-posts'><a
 href='edit.php?category_name=arvizturo-
 tukorfurogep'>0</a></td></tr>]]></parents><noparents><![CDATA[<tr
 id="tag-149" class="alternate"><th scope="row" class="check-column"><label
 class="screen-reader-text" for="cb-select-149">Select ГЃrvГ­ztЕ±rЕ‘
 tükörfúrógép</label><input type="checkbox" name="delete_tags[]"
 value="149" id="cb-select-149" /></th><td class='name column-
 name'><strong><a class="row-title" href="http://trunk.wordpress/wp-admin
 /edit-
 tags.php?action=edit&#038;taxonomy=category&#038;tag_ID=149&#038;post_type=post"
 title="Редактировать &laquo;Árvíztűrő
 tükörfúrógép&raquo;">Árvíztűrő tükörfúrógép</a></strong><br
 /><div class="row-actions"><span class='edit'><a
 href="http://trunk.wordpress/wp-admin/edit-
 tags.php?action=edit&#038;taxonomy=category&#038;tag_ID=149&#038;post_type=post">�зменить</a>
 | </span><span class='inline hide-if-no-js'><a href="#"
 class="editinline">Свойства</a> | </span><span class='delete'><a
 class='delete-tag' href='edit-
 tags.php?action=delete&amp;taxonomy=category&amp;tag_ID=149&amp;_wpnonce=23ee944760'>Удалить</a>
 | </span><span class='view'><a href="http://trunk.wordpress/category
 /arvizturo-tukorfurogep/">Перейти</a></span></div><div
 class="hidden" id="inline_149"><div class="name">ГЃrvГ­ztЕ±rЕ‘
 tükörfúrógép</div><div class="slug">arvizturo-tukorfurogep</div><div
 class="parent">0</div></div></td><td class='description column-
 description'></td><td class='slug column-slug'>arvizturo-
 tukorfurogep</td><td class='posts column-posts'><a
 href='edit.php?category_name=arvizturo-
 tukorfurogep'>0</a></td></tr>]]></noparents></supplemental></taxonomy></response><response
 action='add-tag_0'><term id='0'
 position='0'><response_data><![CDATA[]]></response_data><supplemental><term_id><![CDATA[149]]></term_id><name><![CDATA[ГЃrvГ­ztЕ±rЕ‘
 tükörfúrógép]]></name><slug><![CDATA[arvizturo-
 tukorfurogep]]></slug><term_group><![CDATA[0]]></term_group><term_taxonomy_id><![CDATA[166]]></term_taxonomy_id><taxonomy><![CDATA[category]]></taxonomy><description><![CDATA[]]></description><parent><![CDATA[0]]></parent><count><![CDATA[0]]></count></supplemental></term></response></wp_ajax>
 }}}
 {{{
 Timestamp: 07.08.2012 14:16:41
 Error: TypeError: res.responses[0] is undefined
 Source File: http://trunk.wordpress/wp-
 admin/js/tags.dev.js?ver=3.5-alpha-21466
 Line: 46
 }}}

  `AddDefaultCharset utf-8` in .htaccess doesn't help.

 [attachment:19448.2.diff] is the refreshed patch. Not sure if
 `nocache_headers()` and `Content-Length` are necessary though.
 [attachment:19448.charset-only.diff] just fixes the charset issue.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19448#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list