1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

[305218][dstore] problem reading double-byte characters through data socket layer

This commit is contained in:
David McKnight 2010-03-11 16:21:46 +00:00
parent 3c37093c41
commit 4af8ee6277
2 changed files with 24 additions and 6 deletions

View file

@ -31,6 +31,7 @@ import java.net.URL;
import java.util.ArrayList;
import org.eclipse.dstore.core.java.IRemoteClassInstance;
import org.eclipse.dstore.core.model.DE;
import org.eclipse.dstore.core.model.DataElement;
import org.eclipse.dstore.core.model.DataStore;
@ -69,7 +70,15 @@ public class Sender implements ISender
try
{
_outFile = new PrintStream(_socket.getOutputStream());
_outData = new BufferedWriter(new OutputStreamWriter(_socket.getOutputStream()));
String encoding = DE.ENCODING_UTF_8;
if (!_dataStore.isVirtual()){
encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
}
OutputStreamWriter writer = new OutputStreamWriter(_socket.getOutputStream(), encoding);
_outData = new BufferedWriter(writer);
_xmlGenerator.setFileWriter(_outFile);
_xmlGenerator.setDataWriter(_outData);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2009 IBM Corporation and others.
* Copyright (c) 2002, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -17,6 +17,7 @@
* David McKnight (IBM) [222163][dstore] Special characters from old server are not restored
* David McKnight (IBM) [224906] [dstore] changes for getting properties and doing exit due to single-process capability
* David McKnight (IBM) [246826][dstore] KeepAlive does not work correctly
* David McKnight (IBM) [305218][dstore] problem reading double-byte characters through data socket layer
*******************************************************************************/
package org.eclipse.dstore.internal.core.util;
@ -443,15 +444,22 @@ public class XMLparser
if (offset > 0)
{
String result = null;
String result = null;
String encoding = DE.ENCODING_UTF_8;
if (!_dataStore.isVirtual()){
encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
}
try
{
result = new String(_byteBuffer, 0, offset, DE.ENCODING_UTF_8);
result = new String(_byteBuffer, 0, offset, encoding);
}
catch (IOException e)
{
_dataStore.trace(e);
}
}
return result;
}
else
@ -514,7 +522,7 @@ public class XMLparser
if (xmlTag != null)
{
String trimmedTag = xmlTag.trim();
if (trimmedTag.length() > 0){
if (_dataStore.getReferenceTag() == null)
{
@ -729,6 +737,7 @@ public class XMLparser
}
}
}
}
if (_panic)
return null;