# HG changeset patch # User Artem Tikhomirov # Date 1367247750 -7200 # Node ID c18095eedde0663998bfdd68b9c58ddc1ca53624 # Parent 41218d84842ab0fe7bbc4c6cc6af39d9fa85f6fe Username in changeset uses UTF-8, not system encoding diff -r 41218d84842a -r c18095eedde0 src/org/tmatesoft/hg/repo/HgChangelog.java --- a/src/org/tmatesoft/hg/repo/HgChangelog.java Mon Apr 29 16:37:57 2013 +0200 +++ b/src/org/tmatesoft/hg/repo/HgChangelog.java Mon Apr 29 17:02:30 2013 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 TMate Software Ltd + * Copyright (c) 2010-2013 TMate Software Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -247,10 +247,19 @@ if (breakIndex2 == -1) { throw new HgInvalidDataFormatException("Bad Changeset data"); } - String _user = new String(data, breakIndex1 + 1, breakIndex2 - breakIndex1 - 1); - if (usersPool != null) { - _user = usersPool.unify(_user); + String _user; + try { + // TODO use encoding helper? Although where encoding is fixed (like here), seems to be just too much + _user = new String(data, breakIndex1 + 1, breakIndex2 - breakIndex1 - 1, "UTF-8"); + if (usersPool != null) { + _user = usersPool.unify(_user); + } + } catch (UnsupportedEncodingException ex) { + _user = ""; + // Could hardly happen + throw new HgInvalidDataFormatException("Bad Changeset data", ex); } + int breakIndex3 = indexOf(data, lineBreak, breakIndex2 + 1, bufferEndIndex); if (breakIndex3 == -1) { throw new HgInvalidDataFormatException("Bad Changeset data");