mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 21:45:22 +02:00
[179939] BIDI3.3: HCG Text files written in ASCII Hebrew do not look correctly. Do not download to UTF-8 encoding unnecessarily. Just download to the encoding that is specified for the remote file.
If an encoding is not explicitly specified, then download in the platform defalt encoding.
This commit is contained in:
parent
9c2d3393e7
commit
49f5af68cc
6 changed files with 25 additions and 15 deletions
|
@ -598,7 +598,7 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
subsystem.download(remoteFile, localPath, SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
subsystem.download(remoteFile, localPath, remoteFile.getEncoding(), monitor);
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1438,7 +1438,7 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (!properties.getUsedBinaryTransfer()) {
|
if (!properties.getUsedBinaryTransfer()) {
|
||||||
encoding = SystemEncodingUtil.ENCODING_UTF_8;
|
encoding = remoteFile.getEncoding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,13 @@ public class SystemUniversalTempFileListener extends SystemTempFileListener
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// upload our pending changes to the remote file
|
// upload our pending changes to the remote file
|
||||||
fs.upload(tempFile.getLocation().makeAbsolute().toOSString(), remoteFile, SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
String srcEncoding = tempFile.getCharset(true);
|
||||||
|
|
||||||
|
if (srcEncoding == null) {
|
||||||
|
srcEncoding = remoteFile.getEncoding();
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.upload(tempFile.getLocation().makeAbsolute().toOSString(), remoteFile, srcEncoding, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (RemoteFileSecurityException e)
|
catch (RemoteFileSecurityException e)
|
||||||
|
|
|
@ -167,7 +167,8 @@ public class UniversalFileTransferUtility
|
||||||
// copy remote file to workspace
|
// copy remote file to workspace
|
||||||
SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
|
SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
|
||||||
listener.addIgnoreFile(tempFile);
|
listener.addIgnoreFile(tempFile);
|
||||||
srcFS.download(srcFileOrFolder, tempFile.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
String remoteEncoding = srcFileOrFolder.getEncoding();
|
||||||
|
srcFS.download(srcFileOrFolder, tempFile.getLocation().makeAbsolute().toOSString(), remoteEncoding, monitor);
|
||||||
listener.removeIgnoreFile(tempFile);
|
listener.removeIgnoreFile(tempFile);
|
||||||
if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
|
if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
|
||||||
{
|
{
|
||||||
|
@ -196,12 +197,12 @@ public class UniversalFileTransferUtility
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String cset = tempFile.getCharset();
|
String cset = tempFile.getCharset();
|
||||||
if (!cset.equals(SystemEncodingUtil.ENCODING_UTF_8))
|
if (!cset.equals(remoteEncoding))
|
||||||
{
|
{
|
||||||
|
|
||||||
//System.out.println("charset ="+cset);
|
//System.out.println("charset ="+cset);
|
||||||
//System.out.println("tempfile ="+tempFile.getFullPath());
|
//System.out.println("tempfile ="+tempFile.getFullPath());
|
||||||
tempFile.setCharset(SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
tempFile.setCharset(remoteEncoding, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -528,7 +529,8 @@ public class UniversalFileTransferUtility
|
||||||
// copy remote file to workspace
|
// copy remote file to workspace
|
||||||
SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
|
SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
|
||||||
listener.addIgnoreFile(tempFile);
|
listener.addIgnoreFile(tempFile);
|
||||||
download(srcFileOrFolder, tempFile, SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
|
||||||
|
download(srcFileOrFolder, tempFile, encoding, monitor);
|
||||||
listener.removeIgnoreFile(tempFile);
|
listener.removeIgnoreFile(tempFile);
|
||||||
if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
|
if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
|
||||||
{
|
{
|
||||||
|
@ -549,9 +551,9 @@ public class UniversalFileTransferUtility
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String cset = tempFile.getCharset();
|
String cset = tempFile.getCharset();
|
||||||
if (!cset.equals(SystemEncodingUtil.ENCODING_UTF_8))
|
if (!cset.equals(encoding))
|
||||||
{
|
{
|
||||||
tempFile.setCharset(SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
tempFile.setCharset(encoding, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -313,7 +313,7 @@ public class SystemRemoteEditManager
|
||||||
|
|
||||||
description.setNatureIds(newNatures);
|
description.setNatureIds(newNatures);
|
||||||
editProject.setDescription(description, null);
|
editProject.setDescription(description, null);
|
||||||
editProject.setDefaultCharset(SystemEncodingUtil.ENCODING_UTF_8, new NullProgressMonitor());
|
// editProject.setDefaultCharset(SystemEncodingUtil.ENCODING_UTF_8, new NullProgressMonitor());
|
||||||
|
|
||||||
|
|
||||||
// add java support
|
// add java support
|
||||||
|
|
|
@ -597,11 +597,13 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
destinationFile.setLastModified(localFile.lastModified());
|
destinationFile.setLastModified(localFile.lastModified());
|
||||||
//TODO check if we want to preserve permissions
|
//TODO check if we want to preserve permissions
|
||||||
//if(!localFile.canWrite()) destinationFile.setReadOnly();
|
//if(!localFile.canWrite()) destinationFile.setReadOnly();
|
||||||
if (destinationFile.length() != localFile.length()) {
|
|
||||||
|
// File lengths can be different if the encodings are different
|
||||||
|
/* if (destinationFile.length() != localFile.length()) {
|
||||||
// throw new RemoteFileCancelledException();
|
// throw new RemoteFileCancelledException();
|
||||||
System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
|
System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
||||||
protected IRemoteFile _userHome;
|
protected IRemoteFile _userHome;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public FileServiceSubSystem(IHost host, IConnectorService connectorService, IFileService hostFileService, IHostFileToRemoteFileAdapter fileAdapter, ISearchService searchService)
|
public FileServiceSubSystem(IHost host, IConnectorService connectorService, IFileService hostFileService, IHostFileToRemoteFileAdapter fileAdapter, ISearchService searchService)
|
||||||
{
|
{
|
||||||
|
@ -454,7 +454,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
||||||
File localFile = new File(localpath);
|
File localFile = new File(localpath);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getFileService().download(monitor, parentPath, file.getName(), localFile, isBinary(file), encoding);
|
getFileService().download(monitor, parentPath, file.getName(), localFile, isBinary(file), file.getEncoding());
|
||||||
}
|
}
|
||||||
catch (SystemMessageException e)
|
catch (SystemMessageException e)
|
||||||
{
|
{
|
||||||
|
@ -533,7 +533,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
||||||
{
|
{
|
||||||
String remoteParentPath = destination.getParentPath();
|
String remoteParentPath = destination.getParentPath();
|
||||||
String remoteFileName = destination.getName();
|
String remoteFileName = destination.getName();
|
||||||
String hostEncoding = getRemoteEncoding(); // default host encoding
|
String hostEncoding = destination.getEncoding();
|
||||||
boolean isBinary = isBinary(encoding, hostEncoding, destination.getAbsolutePath());
|
boolean isBinary = isBinary(encoding, hostEncoding, destination.getAbsolutePath());
|
||||||
|
|
||||||
if (!destination.canWrite())
|
if (!destination.canWrite())
|
||||||
|
|
Loading…
Add table
Reference in a new issue