[forge-issues] [JBoss JIRA] (FORGE-895) Shell crops Strings with UTF-8 charaters
George Gastaldi (JIRA)
jira-events at lists.jboss.org
Fri May 10 13:50:53 EDT 2013
[ https://issues.jboss.org/browse/FORGE-895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
George Gastaldi reassigned FORGE-895:
-------------------------------------
Assignee: George Gastaldi
> Shell crops Strings with UTF-8 charaters
> ----------------------------------------
>
> Key: FORGE-895
> URL: https://issues.jboss.org/browse/FORGE-895
> Project: Forge
> Issue Type: Bug
> Components: UI - Shell
> Affects Versions: 1.2.3.Final
> Reporter: Florian Hirsch
> Assignee: George Gastaldi
> Priority: Minor
>
> when I try to print some UTF-8 characters in the shell the end of the line is cropped. E.g.
> {code}
> shell.print("\u2501 Hello World");
> {code}
> results in
> {code}
> ━ Hello Wor
> {code}
> Looks like the org.jboss.forge.shell.buffers.JLineScreenBuffer is calculating the BufferSize wrong:
> {code}
> public synchronized void write(String s) {
> if (bufferSize + s.length() >= maxBufferSize)
> {
> flushBuffer();
> write(s);
> }
> buffer.put(s.getBytes());
> bufferSize += s.length();
> _flush();
> }
> {code}
> s.length() is returning the size of the used Characters, not the Size of the used Bytes. Could be replaced by s.getBytes("UTF-8").length or e.g. [this calculation method|http://stackoverflow.com/questions/8511490/calculating-length-in-utf-8-of-java-string-without-actually-encoding-it/8512877#8512877]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the forge-issues
mailing list