Jump to content

Sanitization and languages / charsets


alexpi
 Share

Recommended Posts

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? 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...