Index: compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java,v retrieving revision 1.147 diff -u -r1.147 TextMergeViewer.java --- compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java 21 Jun 2005 12:37:18 -0000 1.147 +++ compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java 20 Jan 2006 08:43:35 -0000 @@ -1665,17 +1665,22 @@ mcp.setLeftError(null); mcp.setRightError(null); } + + // Get encodings from streams. If an encoding is null, abide by the another one + // Defaults to workbench encoding only if both encodings are null + fLeftEncoding= getEncoding(left); + fRightEncoding= getEncoding(right); + fLeftEncoding = (fLeftEncoding == null ? fRightEncoding : fLeftEncoding); + fRightEncoding = (fRightEncoding == null ? fLeftEncoding : fRightEncoding); // set new documents - setDocument(fLeft, 'L', left); + setDocument(fLeft, 'L', left, fLeftEncoding); fLeftLineCount= fLeft.getLineCount(); - fLeftEncoding= getEncoding(left); - - setDocument(fRight, 'R', right); + + setDocument(fRight, 'R', right, fRightEncoding); fRightLineCount= fRight.getLineCount(); - fRightEncoding= getEncoding(right); - setDocument(fAncestor, 'A', ancestor); + setDocument(fAncestor, 'A', ancestor, fLeftEncoding); updateHeader(); updateControls(); @@ -1740,8 +1745,11 @@ // ignored } } - if (encoding == null) - encoding= ResourcesPlugin.getEncoding(); + // Bug #72995 : don't fall back to default workspace encoding + // Use source stream encoding instead +// if (encoding == null) +// encoding= ResourcesPlugin.getEncoding(); + return encoding; } @@ -1899,7 +1907,7 @@ /* * Returns true if a new Document could be installed. */ - private boolean setDocument(MergeSourceViewer tp, char type, Object o) { + private boolean setDocument(MergeSourceViewer tp, char type, Object o, String encoding) { if (tp == null) return false; @@ -1922,7 +1930,7 @@ String s= null; try { - s= Utilities.readString(sca); + s= Utilities.readString(sca.getContents(), (encoding == null ? ResourcesPlugin.getEncoding() : encoding)); } catch (CoreException ex) { setError(type, ex.getMessage()); }