View | Details | Raw Unified | Return to bug 72995 | Differences between
and this patch

Collapse All | Expand All

(-)compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java (-10 / +18 lines)
Lines 1665-1681 Link Here
1665
			mcp.setLeftError(null);
1665
			mcp.setLeftError(null);
1666
			mcp.setRightError(null);
1666
			mcp.setRightError(null);
1667
		}
1667
		}
1668
1669
		// Get encodings from streams. If an encoding is null, abide by the another one
1670
		// Defaults to workbench encoding only if both encodings are null
1671
		fLeftEncoding= getEncoding(left);
1672
		fRightEncoding= getEncoding(right);
1673
		fLeftEncoding = (fLeftEncoding == null ? fRightEncoding : fLeftEncoding);
1674
		fRightEncoding = (fRightEncoding == null ? fLeftEncoding : fRightEncoding);
1668
		
1675
		
1669
		// set new documents
1676
		// set new documents
1670
		setDocument(fLeft, 'L', left);
1677
		setDocument(fLeft, 'L', left, fLeftEncoding);
1671
		fLeftLineCount= fLeft.getLineCount();
1678
		fLeftLineCount= fLeft.getLineCount();
1672
		fLeftEncoding= getEncoding(left);
1679
		
1673
1680
		setDocument(fRight, 'R', right, fRightEncoding);
1674
		setDocument(fRight, 'R', right);
1675
		fRightLineCount= fRight.getLineCount();
1681
		fRightLineCount= fRight.getLineCount();
1676
		fRightEncoding= getEncoding(right);
1677
		
1682
		
1678
		setDocument(fAncestor, 'A', ancestor);
1683
		setDocument(fAncestor, 'A', ancestor, fLeftEncoding);
1679
		
1684
		
1680
		updateHeader();
1685
		updateHeader();
1681
		updateControls();
1686
		updateControls();
Lines 1740-1747 Link Here
1740
				// ignored
1745
				// ignored
1741
			}
1746
			}
1742
		}
1747
		}
1743
		if (encoding == null)
1748
		// Bug #72995 : don't fall back to default workspace encoding
1744
			encoding= ResourcesPlugin.getEncoding();
1749
		// Use source stream encoding instead
1750
//		if (encoding == null)
1751
//			encoding= ResourcesPlugin.getEncoding();
1752
1745
		return encoding;
1753
		return encoding;
1746
	}
1754
	}
1747
	
1755
	
Lines 1899-1905 Link Here
1899
	/*
1907
	/*
1900
	 * Returns true if a new Document could be installed.
1908
	 * Returns true if a new Document could be installed.
1901
	 */
1909
	 */
1902
	private boolean setDocument(MergeSourceViewer tp, char type, Object o) {
1910
	private boolean setDocument(MergeSourceViewer tp, char type, Object o, String encoding) {
1903
		
1911
		
1904
		if (tp == null)
1912
		if (tp == null)
1905
			return false;
1913
			return false;
Lines 1922-1928 Link Here
1922
				String s= null;
1930
				String s= null;
1923
		
1931
		
1924
				try {
1932
				try {
1925
					s= Utilities.readString(sca);
1933
					s= Utilities.readString(sca.getContents(), (encoding == null ? ResourcesPlugin.getEncoding() : encoding));
1926
				} catch (CoreException ex) {
1934
				} catch (CoreException ex) {
1927
					setError(type, ex.getMessage());
1935
					setError(type, ex.getMessage());
1928
				}
1936
				}

Return to bug 72995