Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgChangelog.java @ 589:c18095eedde0
Username in changeset uses UTF-8, not system encoding
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 29 Apr 2013 17:02:30 +0200 |
parents | 1ee452f31187 |
children | 46f29b73e51e |
comparison
equal
deleted
inserted
replaced
588:41218d84842a | 589:c18095eedde0 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010-2012 TMate Software Ltd | 2 * Copyright (c) 2010-2013 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
245 Nodeid _nodeid = Nodeid.fromAscii(data, 0, breakIndex1); | 245 Nodeid _nodeid = Nodeid.fromAscii(data, 0, breakIndex1); |
246 int breakIndex2 = indexOf(data, lineBreak, breakIndex1 + 1, bufferEndIndex); | 246 int breakIndex2 = indexOf(data, lineBreak, breakIndex1 + 1, bufferEndIndex); |
247 if (breakIndex2 == -1) { | 247 if (breakIndex2 == -1) { |
248 throw new HgInvalidDataFormatException("Bad Changeset data"); | 248 throw new HgInvalidDataFormatException("Bad Changeset data"); |
249 } | 249 } |
250 String _user = new String(data, breakIndex1 + 1, breakIndex2 - breakIndex1 - 1); | 250 String _user; |
251 if (usersPool != null) { | 251 try { |
252 _user = usersPool.unify(_user); | 252 // TODO use encoding helper? Although where encoding is fixed (like here), seems to be just too much |
253 } | 253 _user = new String(data, breakIndex1 + 1, breakIndex2 - breakIndex1 - 1, "UTF-8"); |
254 if (usersPool != null) { | |
255 _user = usersPool.unify(_user); | |
256 } | |
257 } catch (UnsupportedEncodingException ex) { | |
258 _user = ""; | |
259 // Could hardly happen | |
260 throw new HgInvalidDataFormatException("Bad Changeset data", ex); | |
261 } | |
262 | |
254 int breakIndex3 = indexOf(data, lineBreak, breakIndex2 + 1, bufferEndIndex); | 263 int breakIndex3 = indexOf(data, lineBreak, breakIndex2 + 1, bufferEndIndex); |
255 if (breakIndex3 == -1) { | 264 if (breakIndex3 == -1) { |
256 throw new HgInvalidDataFormatException("Bad Changeset data"); | 265 throw new HgInvalidDataFormatException("Bad Changeset data"); |
257 } | 266 } |
258 String _timeString = new String(data, breakIndex2 + 1, breakIndex3 - breakIndex2 - 1); | 267 String _timeString = new String(data, breakIndex2 + 1, breakIndex3 - breakIndex2 - 1); |