Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/EncodingHelper.java @ 682:f568330dd9c0
Compile with Java5, ensure generics are fine for other compilers, too
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 22 Jul 2013 22:47:06 +0200 |
parents | fba85bc1dfb8 |
children |
comparison
equal
deleted
inserted
replaced
681:4f93bbc73b64 | 682:f568330dd9c0 |
---|---|
178 private String decodeUnicodeWithFallback(byte[] data, int start, int length) { | 178 private String decodeUnicodeWithFallback(byte[] data, int start, int length) { |
179 try { | 179 try { |
180 return utfDecoder.decode(ByteBuffer.wrap(data, start, length)).toString(); | 180 return utfDecoder.decode(ByteBuffer.wrap(data, start, length)).toString(); |
181 } catch (CharacterCodingException ex) { | 181 } catch (CharacterCodingException ex) { |
182 // TODO post-1.2 respect ui.fallbackencoding actual setting | 182 // TODO post-1.2 respect ui.fallbackencoding actual setting |
183 return new String(data, start, length, Charset.forName("ISO-8859-1")); | 183 try { |
184 return new String(data, start, length, "ISO-8859-1"); // XXX java5 | |
185 } catch (UnsupportedEncodingException e) { | |
186 throw new HgInvalidStateException(ex.getMessage()); | |
187 } | |
184 } | 188 } |
185 } | 189 } |
186 | 190 |
187 private ByteBuffer encodeUnicode(CharSequence s) { | 191 private ByteBuffer encodeUnicode(CharSequence s) { |
188 // | 192 // |