[
https://issues.jboss.org/browse/FORGE-895?page=com.atlassian.jira.plugin....
]
George Gastaldi closed FORGE-895.
---------------------------------
Fix Version/s: 1.3.0.Final
Resolution: Done
Fixed, thanks !
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
Fix For: 1.3.0.Final
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-u...]
--
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