mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 04:55:22 +02:00
[215847]SystemEncodingUtil needs to convert to unsigned when checking xml file
This commit is contained in:
parent
4ac2da3c9d
commit
cecc399ee8
1 changed files with 13 additions and 4 deletions
|
@ -12,7 +12,8 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* David McKnight (IBM) [215847]SystemEncodingUtil needs to convert to unsigned when checking xml file
|
||||||
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.clientserver;
|
package org.eclipse.rse.services.clientserver;
|
||||||
|
@ -116,13 +117,21 @@ public class SystemEncodingUtil {
|
||||||
if (encodingGuess == null) {
|
if (encodingGuess == null) {
|
||||||
|
|
||||||
stream = new FileInputStream(filePath);
|
stream = new FileInputStream(filePath);
|
||||||
|
|
||||||
byte[] temp = new byte[4];
|
byte[] tempSigned = new byte[4];
|
||||||
|
|
||||||
stream.read(temp);
|
stream.read(tempSigned);
|
||||||
|
|
||||||
stream.close();
|
stream.close();
|
||||||
|
|
||||||
|
|
||||||
|
// convert to unsigned
|
||||||
|
int[] temp = new int[4];
|
||||||
|
for (int i = 0; i < 4; i++){
|
||||||
|
temp[i] = 0xFF & tempSigned[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC, or any other 7-bit,
|
// UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC, or any other 7-bit,
|
||||||
// 8-bit, or mixed-width encoding which ensures that the characters of ASCII have their
|
// 8-bit, or mixed-width encoding which ensures that the characters of ASCII have their
|
||||||
// normal positions, width, and values; the actual encoding declaration must be read to
|
// normal positions, width, and values; the actual encoding declaration must be read to
|
||||||
|
|
Loading…
Add table
Reference in a new issue