alexpi Posted April 7, 2014 Posted April 7, 2014 Hello, I have a problem with a multi-language site and sanitization. When I sanitize the inputs that are entered in other languages than english, I get no return value. Everything on the site is in utf-8. Any insights?
Soma Posted April 7, 2014 Posted April 7, 2014 Any more useful infos or code that shows what you're talking about?
alexpi Posted April 8, 2014 Author Posted April 8, 2014 Sorry, this must have been vague! I have a contact.php file with PW bootstrapped, called via AJAX that contains the following code: include('../index.php'); $contact = $wire->pages->get('/settings/contact/'); $contact->of(true); $language = $wire->user->language; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $emailTo = 'an email'; $name = $wire->input->post['name']; $email = $wire->input->post['email']; $message = $wire->input->post['message']; $form = array( 'name' => $wire->sanitizer->name($name), 'email' => $wire->sanitizer->email($email), 'message' => $wire->sanitizer->textarea($message) ); // below is some form validation code that is irrelevant The form code is: <form action='<?php echo $root->url ?>includes/contact.php' method='post'> <div> <input type="text" id="name" name="name" placeholder="name" required /> <input type="email" id="email" name="email" placeholder="email" required /> <input type="submit" name="submit" value="send" /> </div> <textarea id="message" name="message" placeholder="your message" required ></textarea> <div class="contact_message"></div> <div class="loading hidden"></div> </form> If I enter information in the form in English, the form works as expected. If I type in Greek, the form submission does not occur. If I remove the sanitizer functions, the Greek data pass and the form works again.
Martijn Geerts Posted April 8, 2014 Posted April 8, 2014 Is the mbstring extension for PHP loaded ? // If this function tells something like: Unknown function 'mb_strlen' // then multibyte support is not functioning/enabled <?php mb_strlen("test"); ?>
alexpi Posted April 9, 2014 Author Posted April 9, 2014 I found out that $sanitizer->name() only accepts latin characters. I changed to $sanitizer->text() and it works in any language.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now