Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:18:28+00:00 2026-06-02T01:18:28+00:00

I was using this to save my data into the Database: $this->request->data[‘Post’][‘body’] = utf8_decode($this->request->data[‘Post’][‘body’]);

  • 0

I was using this to save my data into the Database:

$this->request->data['Post']['body'] = utf8_decode($this->request->data['Post']['body']);

Like that, i could save into my DB some “special” characters like the ones with accents:
áéíóú without any problem.

Then, i tried to protect my application from HTML and SQL injections and i used Sanitization like this:

$this->request->data['Post']['body'] = Sanitize::html($this->request->data['Post']['body']);

So now my text is stored on the database like this:

á = á
é = é
í = í ...etc

And i dont want that. Also, my field on the DB has a maximun of characters and this doesn’t help.

I have also tried to use the options param at sanitize with encode = true, encode = false or encode = ‘utf8’ but nothing seems to change.

What should i do?
Thanks.

UPDATE 1

I have also tried to use htmlentities function on my controller but it inserts this in my database instead of á:

Ã
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:18:30+00:00Added an answer on June 2, 2026 at 1:18 am

    If you’re using Cake to save your data (i.e., using save() not query()) then you are protected against SQL injection. It escapes values automatically.

    As stated in the docs, Sanitize::html() will convert characters to HTML entities, such as >, á, etc. You probably shouldn’t use it unless you specifically want HTML entities. Cake will take care of storing your accents in the database just fine if you have the proper encoding on your app and tables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to save data from my database into xml file. I am using
I have an application that is saving clob data into database. Suppose when I
In my application I want to save some string data into an array. This
I'm using this code to save images from a specific URL using Image::Grab .
I am using this line to obtain and save an image from a URL.
I'm using this piece of code to try and save an image to the
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
how can we save dragged item with cookies. I'm using Jquery with this code
hello frieds this is how i usually post a variable using Jquery.. $.post(include/save_legatee.inc.php, {
I have created one application, where I am storing the data into database and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.