PHP - How to find out the encoding of a site.
- Last updated: Nov 3, 2023
- Views: 290
- Author: Admin
In today's article we will talk about how to see how you have set the encoding on the site.
Sometimes you need to know how you have the encoding set on the site, but not everyone knows how to do this, and many novice web developers struggle with scribbles on the page, or when adding information to the database, the content turns into a bunch of incomprehensible characters. There are two ways to check which encoding you currently have on the site. The first way is to use the php function mb_internal_encoding(), and the second way is to use the php function phpinfo().
The content of the article:
- Function mb_internal_encoding().
- Function phpinfo().
1. Function mb_internal_encoding().
Using the mb_internal_encoding() function, you can not only get the current encoding, but also set the encoding you need by passing it the encoding name as a parameter.
2. Function phpinfo().
The phpinfo() function returns absolutely all information about the current PHP configuration. Among all the information that the function returns, the default_charset parameter is just responsible for what encoding you currently have installed.
Thank you all, I hope my article was of some help to you.