Hi Prasanta,
Please use --- keyword.startsWith("ansicpg") instead keyword.contains. I will be providing testcase for this issue soon. Thanks Jay -----"swing-dev" <swing-dev-boun...@openjdk.java.net> wrote: ----- To: swing-dev@openjdk.java.net From: swing-dev-requ...@openjdk.java.net Sent by: "swing-dev" Date: 05/14/2020 05:36PM Subject: [EXTERNAL] swing-dev Digest, Vol 157, Issue 12 Send swing-dev mailing list submissions to swing-dev@openjdk.java.net To subscribe or unsubscribe via the World Wide Web, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openjdk.java.net_mailman_listinfo_swing-2Ddev&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=rA_13vli8clPM_toR46hq8FVwH3XGr8z7cUfcQoqL-k&m=S43bc-lWrQxQzRKtgpihoAxjmOipTneGx_mz9beXCzw&s=QA9iD2vt2grg7_Xk_OuLVEL7emufCeAJgv4w9wOld1w&e= or, via email, send a message with subject or body 'help' to swing-dev-requ...@openjdk.java.net You can reach the person managing the list at swing-dev-ow...@openjdk.java.net When replying, please edit your Subject line so it is more specific than "Re: Contents of swing-dev digest..." Today's Topics: 1. RFR JDK-8244324: RTFEditorKit does not display some of Japanese characters correctly (Prasanta Sadhukhan) ---------------------------------------------------------------------- Message: 1 Date: Thu, 14 May 2020 16:20:21 +0530 From: Prasanta Sadhukhan <prasanta.sadhuk...@oracle.com> To: "swing-dev@openjdk.java.net" <swing-dev@openjdk.java.net>, vyomm...@gmail.com Subject: <Swing Dev> RFR JDK-8244324: RTFEditorKit does not display some of Japanese characters correctly Message-ID: <fdff4646-f033-a443-992a-282d3fbfd...@oracle.com> Content-Type: text/plain; charset="utf-8"; Format="flowed" Hi All, Please review a fix for an issue seen whereby RTFEditorKit used to read Japanese characters reads some garbage characters. The default character set used for the RTF document is set to "ansi" in our RTFReader.java. And share/classes/javax/swing/text/rtf/charsets/ansi.txt code table has undefined values , i.e., 91-98 and A0 are "0". According to javax/swing/text/rtf/RTFParser.java, If the ch is 0, handleText() is not called As per https://urldefense.proofpoint.com/v2/url?u=http-3A__www.biblioscape.com_rtf15-5Fspec.htm-23Heading8&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=rA_13vli8clPM_toR46hq8FVwH3XGr8z7cUfcQoqL-k&m=S43bc-lWrQxQzRKtgpihoAxjmOipTneGx_mz9beXCzw&s=_MgMvoKYK3puN460Ku3bp2-lA65JQ-pRTrWUvLe52Ac&e= , /RTF file includes the following Character set in its header : // //<character set> // //?(\ansi | \mac | \pc | \pca)? \ansicpgN? // //Where, // //\ansicpgN This keyword represents the default ANSI code page used to perform the *Unicode to ANSI conversion* when writing RTF text. N represents the code page in decimal. This is typically set to the default ANSI code page of the run-time environment (for example, \ansicpg1252 for U.S. Windows). The reader can use the same ANSI code page to convert ANSI text back to Unicode. This keyword should be emitted in the RTF header section right after the \ansi, \mac, \pc or \pca keyword. / Possible values include those in the following table.We can make use of ansicpgN (can switch ANSI text to Unicode), define it to refer to the latin1TranslationTable [RTFParser inherits it from AbstractFilter] which does not include undefined areas instead of ansi's translationTable which has undefined areas as seen above. Bug: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.openjdk.java.net_browse_JDK-2D8244324&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=rA_13vli8clPM_toR46hq8FVwH3XGr8z7cUfcQoqL-k&m=S43bc-lWrQxQzRKtgpihoAxjmOipTneGx_mz9beXCzw&s=U7CaQPKmrHtCold9fxVxYKAAo-Hp8nzlgnRFmQaX_oI&e= webrev: https://urldefense.proofpoint.com/v2/url?u=http-3A__cr.openjdk.java.net_-7Epsadhukhan_8244324_webrev.0_&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=rA_13vli8clPM_toR46hq8FVwH3XGr8z7cUfcQoqL-k&m=S43bc-lWrQxQzRKtgpihoAxjmOipTneGx_mz9beXCzw&s=Ou3ad8Rz7nud-wLQ2PudwvYuWC6NYVlhdCe1DD3qtcI&e= Note: I am not able to create a testcase for this as it involves reading from rtf file which probably is copyrighted and inserting Japanese characters as a string (instead of rtf file) was not working. -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openjdk.java.net_pipermail_swing-2Ddev_attachments_20200514_08281d71_attachment-2D0001.htm&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=rA_13vli8clPM_toR46hq8FVwH3XGr8z7cUfcQoqL-k&m=S43bc-lWrQxQzRKtgpihoAxjmOipTneGx_mz9beXCzw&s=l1o373ZTgfU6jtPIoEqqY91XUlytcB-RvqxPk8K0LuY&e= > End of swing-dev Digest, Vol 157, Issue 12 ******************************************