[JIRA] (JENKINS-38121) Patch file processing does not support UTF-8 encoding

0 views
Skip to first unread message

axelheider@gmx.de (JIRA)

unread,
Sep 11, 2016, 9:51:03 PM9/11/16
to jenkinsc...@googlegroups.com
Axel Heider created an issue
 
Jenkins / Bug JENKINS-38121
Patch file processing does not support UTF-8 encoding
Issue Type: Bug Bug
Assignee: Unassigned
Components: patch-parameter-plugin
Created: 2016/Sep/12 1:50 AM
Environment: * Jenkins 1.598
* patch-parameter plugin V1.2
* diff4j-1.2 from https://github.com/cloudbees/diff4j (7f212fe6f891e8eaaa349ed9fc6866c9d1280dd2)
* GNU patch 2.7.5
* SVN 1.9
Labels: encoding java
Priority: Critical Critical
Reporter: Axel Heider

I'm having problem with a patch file that changes a code comment using "’" (RIGHT SINGLE QUOTATION MARK, UTF-8 U+2019 encoded as 0xE2 0x80 0x99) into the (normal?) apostrophe "'" (APOSTROPHE, ASCII 39/0x27). The patch is created with SVN diff (V1.9) in Linux and can be used fine with GNU patch 2.7.5. However, when uploading the patch to jenkins, it can't be applies- The error is

com.cloudbees.diff.PatchException: Cannot apply hunk @@ 245

I've debugged the issue using diff4j-1.2 (7f212fe6f891e8eaaa349ed9fc6866c9d1280dd2) from https://github.com/cloudbees/diff4j in a test java application. Adding some printouts in

com/cloudbees/diff/ContextualPatch.java
private boolean applyHunk(...)
...
if (!targetLine.equals(hunkLine.substring(1).trim())) { // be optimistic, compare trimmed context lines
    System.out.println("hunk: "+hunkLine);
    System.out.println("target: "+targetLine);

where tries to compare lines, I get this:

hunk: - // this commentâ<U+0080><U+0099>s encoding fails
target: // this comment’s encoding fails

Seems Java does not consider the patch file's line as UTF-8, but the source code's line is taken as UTF-8.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

sunshaking@gmail.com (JIRA)

unread,
Sep 11, 2019, 4:20:02 AM9/11/19
to jenkinsc...@googlegroups.com
Xueqing Sun commented on Bug JENKINS-38121
 
Re: Patch file processing does not support UTF-8 encoding

I've encountered the same problem. I'm investigating the issue.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages