Char injected into string of Java class when file sync'd from Git into Jenkins workspace -
i have java class has following:
public static final blob copyright_mark = new blob("div.legal_footer span", "© " + new simpledateformat("yyyy").format(new date()) + " acme llc. rights reserved.");
the project class stored in git repo , pulled jenkins job run unit tests. when file pulled jenkins job workspace, character injected before copyright symbol in string:
public static final blob copyright_mark = new blob("div.legal_footer span", "© " + new simpledateformat("yyyy").format(new date()) + " acme llc. rights reserved.");
this causing test failure.
the java class encoded utf-8. project can built , test run locally without problems. jenkins instance running on osx. code written on mac.
i'm stumped why file being altered when pulled workspace.
any suggestions of check?
you need declare in configuration file/parameter/environment variable encoding used utf-8. having file physically encoded utf-8 half battle, reader of file needs informed of fact well.
there no character injection, it's coincidence mojibake contains copyright character well.
you have encoded file utf-8, in reality has bytes:
0xc2 0xa9
when reader of file knows interpret file utf-8, character ©
correctly appear.
however, if reader of file not know encoding interpret file in, interpreted incorrectly.
in case file incorrectly interpreted possibly windows-1252/cp1252/"ansi" or iso-8859-1. in encodings 0xc2 0xa9
decodes ©
, other bytes decode same characters in utf-8 - again coincidence. if used characters same encoding mapping, wouldn't notice there problem.
Comments
Post a Comment