Comments (6)
It has something to do with Jansi.
If I skip the Jansi Test, everything works fine!
package testprog;
public class AnsiKonsoleTestJansi {
public static void main(String[] args) {
// Direct Test
System.out.println("Hello \u001b[1;31mred\u001b[0m world!");
}
}
Produces:
Hello �red world!
where red is printed in red 👍
from ansi-econsole.
Now it is perfect.
package testprog;
import static org.fusesource.jansi.Ansi.ansi;
import static org.fusesource.jansi.Ansi.Color.GREEN;
import static org.fusesource.jansi.Ansi.Color.RED;
public class AnsiKonsoleTestJansi {
public static void main(String[] args) {
// Test with Jansi
// In Eclipse: Remove:
// AnsiConsole.systemInstall();
// In Eclipse: Don't do eraseScreen().
System.out.println(ansi().isEnabled());
System.out.println(ansi().fg(RED).a("Hello").fg(GREEN).a(" World")
.reset());
System.out.println(ansi().render("@|red Hello|@ @|green World|@"));
// Direct Test
System.out.println("Hello \u001b[1;31mred\u001b[0m world!");
}
}
from ansi-econsole.
Do you use http://mvnrepository.com/artifact/org.fusesource.jansi/jansi/1.11 ?
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.11</version>
</dependency>
nice to know
from ansi-econsole.
@paulvi
Yes, I like jansi; (in fact, I have even contributed some improvements :-)
I usually download jansi directly from http://jansi.fusesource.org/
And when I need it in maven (for instance in https://github.com/mihnita/java-color-loggers), then I add the dependency, and "just works" (probably comes from mvnrepository, but I have never checked)
from ansi-econsole.
One of my comments at http://mihai-nita.net/java has another solution, jansi.passthrough:
One cause possible: many libraries detect if the standard output is redirected, and if that is the case, they don’s output ANSI escapes anymore.
In most cases there are ways to force them to do that, but the solution is library specific. One example is jansi, and the way to force it is by setting jansi.passthrough
This means you can pass it as a parameter at execution and you don't need to touch the code at all.
from ansi-econsole.
@paulvi, mihnita
yes, I am using jansi Version 1.11.
I can confirm: doing before anything else:
System.setProperty("jansi.passthrough", "true");
works perfect.
from ansi-econsole.
Related Issues (20)
- Installation error HOT 3
- Support for setting ANSI console enablement default from another Eclipse Plugin HOT 3
- copy/paste without escape characters doesn't seem to work anymore HOT 13
- Console hang issue and slow performance on Windows HOT 10
- Not working on eclipse kepler HOT 2
- Ansi Console catches CTRL+C HOT 9
- Menu -- Copy & context menu -- Copy should copy without escapes
- Dual / Relicence under EPL2.0 / Contribute to Eclipse HOT 30
- Full support for terminal ProgressBar HOT 1
- Parameter default values are not recognized HOT 1
- CDT default colors are lost HOT 9
- Console is not updated when a property change HOT 1
- Color errors with Project -- Build All HOT 3
- Changing C/C++ output text color breaks ansi-econsole HOT 2
- Escape code ignore sometimes HOT 3
- Eclipse 2022-06 HOT 9
- Detect Eclipse 2022-09 and warn to uninstall HOT 1
- Console prints some extended unicode glyphs as 'unknown' HOT 2
- installed it, enabled it, restarted eclipse multiple times and cannot get it to work HOT 1
- DepShield Deprecation Notice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansi-econsole.