Skip to content

Tag: utf-8

Decode string with x in PHP that has char encoded over 255

My problem is about string decoding. Let’s assume a string like: I want to decode it and to look like that: λƛ¬∧⟑∨⟇÷ €½∆ø↔¢⌐æ I tried to use But it’s not what was expected. In python something like that works: Answer You don’t need to decode that. This is legal notation for strings in PHP. h…

Codeigniter 4 localization issue with UTF-8 characters

The context I am trying to perform a lemmatization of some texts and I figured out that I can use CI4 localization for this. Basically I created some files in AppLanguagesro-RO and I am “translating” the words to their linguistic root. The language files are encoded in UTF-8 (I checked it on the s…

PHP find the charset set by setlocale

All my websites use UTF-8 as charset. But there are some issues when setting setlocale and getting localized strings from strftime for month names and weekday names. issue: Localizing month names do not work on the server. issue: How to know if the locale stings are in UTF-8 or ISO? Concrete: I set the locale…

utf8_encode difference between result in SQL and PHP

I’m using utf8_encode to make sure that the input from my users is transforming the special characters to a character where my MYSQL can do a search on. (My database is set in latin1_swedish.ci). When I echo my query, I get a perfect query that I can run against my MYSQL (and I get an result). But when …

Clean emoji in input

How can I clean my form inputs for characters like emojis? For example, when I post a paragraph in a text area with an emoji like this ????, a Record does not gets inserted to database. I can not change …