[wp-trac] [WordPress Trac] #59608: [bug] insert_with_markers with a UTF-8 translated marker causing .htaccess file broken with garbled characters

WordPress Trac noreply at wordpress.org
Fri Oct 13 03:26:28 UTC 2023


#59608: [bug] insert_with_markers with a UTF-8 translated marker causing .htaccess
file broken with garbled characters
--------------------------+-----------------------------
 Reporter:  sammyhk       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.3.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 We encountered issue when the site language is setting to `Chinese (Hong
 Kong)`, the `translators: 1: Marker.` have a translation
 (https://translate.wordpress.org/projects/wp/dev/admin/zh-
 hk/default/?filters%5Boriginal_id%5D=8431526&filters%5Bstatus%5D=either&filters%5Btranslation_id%5D=91677098)
 which contains UTF-8 characters. When calling `insert_with_markers(...)`
 to write values to `.htaccess` file, the `.htaccess` file will contains
 garbled characters causing Apache cannot parse the file and return HTTP
 500.

 Sample of the broken .htaccess:
 {{{
 # BEGIN WP Cloudflare Super Page Cache
 # 在含有 BEGIN WP Cloudflare Super Page Cache 及 END WP Cloudflare Super
 Page Cache 標記的這�
 �行間的指示詞�
 �容為動�
 �產生,
 # 且應�
 有 WordPress 篩選器能進行修改。對這�
 �行間任何指示詞�
 �容的變更,
 # 都會遭到系統覆寫。
 <IfModule mod_expires.c>
 ...
 }}}

 The expected output should be:
 {{{
 # BEGIN WP Cloudflare Super Page Cache
 # 在含有 BEGIN WP Cloudflare Super Page Cache 及 END WP Cloudflare Super
 Page Cache 標記的這兩行間的指示詞內容為動態產生,
 # 且應僅有 WordPress 篩選器能進行修改。對這兩行間任何指示詞內容的變更,
 # 都會遭到系統覆寫。
 <IfModule mod_expires.c>
 ...
 }}}

 Ref: https://build.trac.wordpress.org/browser/trunk/wp-
 admin/includes/misc.php?marks=141#L140

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59608>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list