Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

mojibake

How to replace � in a string

September 8, 2023 by Tarik

That’s the Unicode Replacement Character, \uFFFD. (info) Something like this should work: String strImport = “For some reason my �double quotes� were lost.”; strImport = strImport.replaceAll(“\uFFFD”, “\””);

Categories java Tags encoding, java, mojibake, string, unicode Leave a comment

Facebook JSON badly encoded

April 24, 2023 by Tarik

I can indeed confirm that the Facebook download data is incorrectly encoded; a Mojibake. The original data is UTF-8 encoded but was decoded as Latin-1 instead. I’ll make sure to file a bug report. What this means is that any non-ASCII character in the string data was encoded twice. First to UTF-8, and then the … Read more

Categories python Tags mojibake, python, python-3.x, unicode Leave a comment

How to convert these strange characters? (ë, Ã, ì, ù, Ã)

March 29, 2023 by Tarik

These are utf-8 encoded characters. Use utf8_decode() to convert them to normal ISO-8859-1 characters.

Categories php Tags character-encoding, mojibake, mysql, php, utf8-decode Leave a comment

Getting ’ instead of an apostrophe(‘) in PHP

March 6, 2023 by Tarik

To convert to HTML entities: <?php echo mb_convert_encoding( file_get_contents(‘http://www.tvrage.com/quickinfo.php?show=Surviver&ep=20×02&exact=0’), “HTML-ENTITIES”, “UTF-8” ); ?> See docs for mb_convert_encoding for more encoding options.

Categories php Tags character-encoding, mojibake, php, utf-8 Leave a comment

How do I remove  from the beginning of a file?

November 13, 2022 by Tarik

Three words for you: Byte Order Mark (BOM) That’s the representation for the UTF-8 BOM in ISO-8859-1. You have to tell your editor to not use BOMs or use a different editor to strip them out. To automatize the BOM’s removal you can use awk as shown in this question. As another answer says, the … Read more

Categories php Tags byte-order-mark, character-encoding, mojibake, php, utf-8 Leave a comment

“’” showing on page instead of ” ‘ “

November 11, 2022 by Tarik

So what’s the problem, It’s a ’ (RIGHT SINGLE QUOTATION MARK – U+2019) character which is being decoded as CP-1252 instead of UTF-8. If you check the encodings table, then you see that this character is in UTF-8 composed of bytes 0xE2, 0x80 and 0x99. If you check the CP-1252 code page layout, then you’ll … Read more

Categories encoding Tags encoding, mojibake, utf-8 Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa