Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2003-11-19 18:24:33 +0000
committerAndre Weinand2003-11-19 18:24:33 +0000
commit3521ebc5128374f28e016d3814ee47dbc41be707 (patch)
treee2d4167cbf11e29df8cb2c358128bd15e53a3d1c
parent0d8c5412206e0c0c1990f68b463731f0654b7f6b (diff)
downloadeclipse.platform.team-3521ebc5128374f28e016d3814ee47dbc41be707.tar.gz
eclipse.platform.team-3521ebc5128374f28e016d3814ee47dbc41be707.tar.xz
eclipse.platform.team-3521ebc5128374f28e016d3814ee47dbc41be707.zip
fixed #46977v20031119a
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html1
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java17
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html1
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java17
4 files changed, 32 insertions, 4 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index 39672318d..96f36ffbc 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -17,6 +17,7 @@ Eclipse Build Input November 19th 2003
Problem reports fixed</h2>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46805">#46805</a>: prepare Compare for encoding support<br>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46877">#46877</a>: Remove dependancies on Xerces<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46977">#46977</a>: Comparing/merging two local files screws up the content<br>
<h1>
<hr WIDTH="100%"></h1>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 2db1b6cb7..0388ee25e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.ResourceBundle;
import java.text.MessageFormat;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
@@ -42,6 +43,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.CoreException;
@@ -1930,8 +1932,19 @@ public class TextMergeViewer extends ContentMergeViewer {
MergeSourceViewer v= left ? fLeft : fRight;
if (v != null) {
IDocument d= v.getDocument();
- if (d != null)
- return Utilities.getBytes(d.get(), "UTF-16"); //$NON-NLS-1$
+ if (d != null) {
+ String contents= d.get();
+ if (contents != null) {
+ byte[] bytes;
+ try {
+ bytes= contents.getBytes(ResourcesPlugin.getEncoding());
+ } catch(UnsupportedEncodingException ex) {
+ // use default encoding
+ bytes= contents.getBytes();
+ }
+ return bytes;
+ }
+ }
}
return null;
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
index 39672318d..96f36ffbc 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
@@ -17,6 +17,7 @@ Eclipse Build Input November 19th 2003
Problem reports fixed</h2>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46805">#46805</a>: prepare Compare for encoding support<br>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46877">#46877</a>: Remove dependancies on Xerces<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=46977">#46977</a>: Comparing/merging two local files screws up the content<br>
<h1>
<hr WIDTH="100%"></h1>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 2db1b6cb7..0388ee25e 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.ResourceBundle;
import java.text.MessageFormat;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
@@ -42,6 +43,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.CoreException;
@@ -1930,8 +1932,19 @@ public class TextMergeViewer extends ContentMergeViewer {
MergeSourceViewer v= left ? fLeft : fRight;
if (v != null) {
IDocument d= v.getDocument();
- if (d != null)
- return Utilities.getBytes(d.get(), "UTF-16"); //$NON-NLS-1$
+ if (d != null) {
+ String contents= d.get();
+ if (contents != null) {
+ byte[] bytes;
+ try {
+ bytes= contents.getBytes(ResourcesPlugin.getEncoding());
+ } catch(UnsupportedEncodingException ex) {
+ // use default encoding
+ bytes= contents.getBytes();
+ }
+ return bytes;
+ }
+ }
}
return null;
}

Back to the top