Closed fonsecas72 closed 11 years ago
I work with ubuntu 12.04 and in my log i get this strange symbol ⊗ whenever a have should have a space. See:
After google it I've found this and maybe you could use it:
public static String escape(String s) { StringBuilder builder = new StringBuilder(); boolean previousWasASpace = false; for( char c : s.toCharArray() ) { if( c == ' ' ) { if( previousWasASpace ) { builder.append(" "); previousWasASpace = false; continue; } previousWasASpace = true; } else { previousWasASpace = false; } switch(c) { case '<': builder.append("<"); break; case '>': builder.append(">"); break; case '&': builder.append("&"); break; case '"': builder.append("""); break; case '\n': builder.append("<br>"); break; // We need Tab support here, because we print StackTraces as HTML case '\t': builder.append(" "); break; default: if( c < 128 ) { builder.append(c); } else { builder.append("&#").append((int)c).append(";"); } } } return builder.toString(); }
from: http://stackoverflow.com/questions/5134959/convert-plain-text-to-html-text-in-java
I've try it and in my pc it works fine.
ok, i will print the whitespace char but i'm using the ⊗ to detect unprintable characters (such as tabs) to detect possible errors during command call.
Can the same be done with "," and "*" ?
I work with ubuntu 12.04 and in my log i get this strange symbol ⊗ whenever a have should have a space. See:![Screenshot from 2013-04-03 17:21:53](https://f.cloud.github.com/assets/1098293/334719/10e1e630-9c7b-11e2-8ae6-31a8c1194998.png)
After google it I've found this and maybe you could use it:
from: http://stackoverflow.com/questions/5134959/convert-plain-text-to-html-text-in-java
I've try it and in my pc it works fine.