Read and Write Text in ANSI format

To read a text file with a specific encoding you can use a FileInputStream in conjunction with a InputStreamReader. The right Java encoding for Windows ANSI is Cp1252. reader = new BufferedReader(new InputStreamReader(new FileInputStream(csvFile), “Cp1252”)); To write a text file with a specific character encoding you can use a FileOutputStream together with a OutputStreamWriter. writer … Read more

json_encode() non utf-8 strings?

Is there a way I can get json_encode() to work and display these characters instead of having to use utf8_encode() on all of my strings and ending up with stuff like “\u0082”? If you have an ANSI encoded string, using utf8_encode() is the wrong function to deal with this. You need to properly convert it … Read more

Colored text output in PowerShell console using ANSI / VT100 codes

Note: The following applies to regular (legacy) console windows on Windows (provided by conhost.exe), which are used by default, including when a console application is launched from a GUI application. By contrast, the console windows (terminals) provided by Windows Terminal provide support for VT / ANSI escape sequences by default, for all console applications. While … Read more

Unicode, UTF, ASCII, ANSI format differences

Going down your list: “Unicode” isn’t an encoding, although unfortunately, a lot of documentation imprecisely uses it to refer to whichever Unicode encoding that particular system uses by default. On Windows and Java, this often means UTF-16; in many other places, it means UTF-8. Properly, Unicode refers to the abstract character set itself, not to … Read more