Posts

Showing posts with the label utf-8

Best way to convert text files between character sets?

Best way to convert text files between character sets? What is the fastest, easiest tool or method to convert text files between character sets? Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa. Everything goes: one-liners in your favorite scripting language, command-line tools or other utilities for OS, web sites, etc. On Linux/UNIX/OS X/cygwin: Gnu iconv suggested by Troels Arvin is best used as a filter . It seems to be universally available. Example: $ iconv -f UTF-8 -t ISO-8859-15 in.txt > out.txt As pointed out by Ben, there is an online converter using iconv. Gnu recode (manual) suggested by Cheekysoft will convert one or several files in-place . Example: $ recode UTF8..ISO-8859-15 in.txt This one uses shorter aliases: $ recode utf8..l9 in.txt Recode also supports surfaces which can be used to convert between different line ending types and encodings: Convert newlines from LF (Unix) to CR-LF (DOS): $ recode ../CR-LF in.txt Base64 encode file: $ recode...

UTF-8 encoding not working in Docker

UTF-8 encoding not working in Docker I'm running a Java program from within a Docker container (started with Docker Compose) and it's throwing a bunch of errors caused by UTF-8 characters (as they can't be mapped to the ASCII charset). Is there a way to enable UTF-8 encoding from the docker-compose file? Seems to me this has nothing to do with docker but all with your Java program. – Henry Jul 1 at 6:28 The program works outside of the Docker container...inside, it outputs "unmappable character for encoding ASCII" when trying to read a French character – Justin Borromeo Jul 1 at 6:43 @JustinBorromeo This proves that you've written your Java ...

How to check if “ ” exist?

How to check if “ ” exist? When I print a variable, I get a blank result and when I inspect the element I see that   .   I tried to check if the variables is empty or equals this value: ir( empty($string) || $string == " " || strpos($string, " ") || $string == " "){ //Do Something. } But the code inside that condition is not executed. When I var_dump($string) , I get: var_dump($string) string(2) " " What should I do to check if the variable equals or contain that? I would suggest to check for null or empty string using trim(): (!isset($string) || trim($string) === '') – wp78de Jul 1 at 6:00 (!isset($string) || trim($string) === '') what is ir ?? – smith ...