0

A simple question: what is the encoding of the input parameters in PHP? I mean GET, POST and so on.

Running some tests, I found that probably they are UTF-8 encoded. Can this be true?

0

2 Answers 2

2

They are in the encoding browser sends them. You can (and should) suggest the browser to use some encoding, like page meta character set or form accept-charset, for example:

<form action="form_action.php" accept-charset="UTF-8">

but you cannot force it. However, if you want to, you can also filter out all input data that is not in the encoding you suggested.

This is not specific to PHP, but applies in general.

Sign up to request clarification or add additional context in comments.

Comments

1

It depends entirely on what was sent with the HTTP request. If the browser sends UTF-8 encoded data, that's what you will read from PHP.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.