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 8871309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:57:35+00:00 2026-06-14T17:57:35+00:00

In my php application since the beginning that i set everything with utf8 to

  • 0

In my php application since the beginning that i set everything with utf8 to avoid future problems. I set my database:

class DATABASE_CONFIG {

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'root',
    'password' => '',
    'database' => 'aquitex',
    'prefix' => '',
    'encoding' => 'utf8',
);

public $test = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'root',
    'password' => '',
    'database' => 'aquitex',
    'prefix' => '',
    'encoding' => 'utf8',
);

}

The file core.php:

Configure::write('App.encoding', 'UTF-8');

And the default layout of the views:

<?php echo $this->Html->charset(); ?>

However, i’m still having problems in some elements like labels of forms.

In my index.ctp file, this line:

echo $this->Html->link("Segurança", array('controller' => 'Posts','action'=> 'add'), array( 'class' => 'button')); 

works perfectly and there’s no problem with the ‘ç’ character.

But in forms, like this:

echo $this->Form->create('Post');
echo $this->Form->input('Nome Produto');
echo $this->Form->input(utf8_encode("Código Produto"));
echo $this->Form->input("Versão");
echo $this->Form->input('Data');
//echo $this->Form->input('body', array('rows' => '3'));
echo $this->Form->end('Criar Ficha');

there’s no way i can get the words on the labels of the form with ‘ó” or ‘ç’ characters showing properly. As you can see i even tried the utf8encode() in one of them.

Any hints? Thank you!

  • 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-14T17:57:37+00:00Added an answer on June 14, 2026 at 5:57 pm

    there is no need to use utf8_encode() in your views.
    you simply forgot to save the view file properly.
    save it as “utf8 without bom” and you will be fine.

    files that do not contain any special utf8 char can still stay as ansi (since there is no difference between them then).
    but every file that does contain such a character you need to save as utf8 (even controllers and models if you plan on using utf8 characters there for error messages etc).

    PS: in general it is wiser to use english and to translate it via PO file into your language.
    this way you can leave the files as they are and you are more flexible (you can add new languages on the fly just by creating a new PO file then).

    EDIT
    After figuring out together that your inputs() use utf8 chars, I will need to update:

    It is wise to use “underscore_field_names” for your db fields (and therefore your input fields) – and in English:

    echo $this->Form->input("version"));
    

    you can easily translate them via PO file afterwards or specifying the label:

    echo $this->Form->input("version", array('label' => 'Versão'));
    

    but the first way is recommended to keep it dry.

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

Sidebar

Related Questions

I have a PHP application that I have been having some problems with, some
I have a PHP application that has grown in size. The database used to
I have a php application that uses the google feed api to get the
I am currently translating my PHP application using gettext with POEdit. Since I respect
I have a PHP application that I want to switch from MySQL to Cache
I'm writing a PHP application that manages some LDAP entries. I have one page
I am writing a PHP application that's supposed to allow users to add certain
I have finalized a small PHP application that can serve many documents. These documents
I have a currently running PHP application that I want to add real-time feed
I'm getting started unit testing my PHP application with PHPUnit. I understand that it's

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.