プロジェクト

全般

プロフィール

Vote #72981

完了

Diff outputs become ??? in some non ASCII words.

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
I18n_37
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
37
version_id:
60
issue_org_id:
12641
author_id:
11192
assigned_to_id:
11192
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
61
ステータス-->[Closed]

説明

An example is r11052 in #12640#note-2.

!diff-r11052.png!


journals

The Problem is, that for example the following diff-lines
<pre><code class="diff">
- часа"
+ часов"
</code></pre>

are parsed in Redmine as UTF-8 like this:
<pre><code>\xD1\x87\xD0\xB0\xD1\x81\xD0<span>\xB0</span>&quot;
\xD1\x87\xD0\xB0\xD1\x81\xD0<span>\xBE\xD0\xB2</span>&quot;
</code></pre>

This is wrong, because the _leading byte_ <code>\xD0</code> is part of the cyrillic 2-Byte character "<code>а</code>" in the <span>-tag, but it's actually outside of the <span>-tag. Therefore charaters will be misinterpreted and will be displayed with "?".

Correct UTF-8 would be:

<pre><code>\xD1\x87\xD0\xB0\xD1\x81<span>\xD0\xB0</span>&quot;
\xD1\x87\xD0\xB0\xD1\x81<span>\xD0\xBE\xD0\xB2</span>&quot;
</code></pre>

So we have for the first line "<code>...<span>\xD0\xB0</span>...</code>" instead of "<code>...\xD0<span>\xB0</span>...</code>". The attached patch searchs for the last _leading byte_, if the unmatching byte is a _continuation byte_ (and not a _leading byte_ or a single character byte).

A _continuation byte_ has the binary format 10xxxxxx, so we can determine it with <code>myContinuationByte.ord.between?(128, 191)</code>

This problem occurs always, when the first determined difference between two bytes are _continuation bytes_. An other example in japanese you find in #13350.
--------------------------------------------------------------------------------
A much better way to fix this problem is to set an UTF-8 encoding. :-)
--------------------------------------------------------------------------------
The affected version is also 2.3 (devel)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed in, thanks.
--------------------------------------------------------------------------------


related_issues

relates,Closed,12640,Russian "about_x_hours" translation change

Admin Redmine さんが約4年前に更新

  • カテゴリI18n_37 にセット
  • 対象バージョン2.3.0_60 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0