How to force PHP to use UTF-8 encoding

I am not sure that my title of the question is clear enough, but I will try to explain it.

I'm really not sure how PHP performs the function mysql_queryin terms of finding and storing strings. Does it recognize any character encodings used in the table?

And my browser by default cancels any character encodings sent through <forms>, that is, if I put 'ä' in any <input>or <textarea>, will these characters be sent as they are?

Further, how would PHP handle these characters? Can I get PHP to write these characters as they are in the database?

Knowing how I created the database tables and their corresponding mappings, how can I get PHP to return the correct string values ​​that were in the database?

I apologize for being too lazy for google, but I ran into this problem earlier in another table and thought I found a solution, but I thought maybe I just checked my browser settings to use UTF encoding by default -8?

Ok, so in this case, the user browser really has power over what type of character encoding they will use to render the page ... are there any workarounds?

Cm:

+3
source share

Source: https://habr.com/ru/post/1699498/


All Articles