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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:37:54+00:00 2026-05-26T02:37:54+00:00

My mother language uses accents and I usually use the utf8_encode to utf8_decode function

  • 0

My mother language uses accents and I usually use the utf8_encode to utf8_decode function in php to avoid problems.

Now I’ve a MySql field of type varchar (utf8_bin) and another of type longtext (utf8_bin).
Varchar returns odd characters, while longtext works good.

Is there a difference between the way they’re managed by php?

$a = "Início";
echo utf8_encode($a)."<br>";
echo utf8_decode($a);

Using MySql field of type varchar I get

Início
In�cio

Using MySql field of type text or longtext I get

Início

witch is the correct output I need.
  • 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-05-26T02:37:55+00:00Added an answer on May 26, 2026 at 2:37 am

    Are you setting the mySQL charset before running your SQL to fetch the text? With regards to the character encoding issues, see here, did you convert the field encoding when there was already content in the fields?

    Unfortunately, a direct conversion like that can mangle the text in
    the database and make it unreadable, especially if there are actual
    international characters (i.e. non-latin languages). The reasons for
    this distortion are complicated and hard to understand, but the result
    is that each column must be converted twice

    […]

    As you can see we first convert the LONGTEXT column to its blob-type
    counterpart: LONGBLOB. Once this is complete, we convert it back to
    LONGTEXT, but with our desired character set of utf8;.

    It sounds like you’re pretty au fait with general encoding issues, though check here if not.

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

Sidebar

Related Questions

I am working on a little website for my mother in php, using mysql.
I developed a little app which uses SendMessage function to turn off monitor. My
I code CSS/XHTML like it should be my mother language, and I do write
Plone is showing the special chars from my mother language (Brazilian Portuguese) in its
I want to map a generic field in a superclass with Hibernate. My mother
English is not my mother tongue. However, I have to write comments in English.
I have two object : Mother and Child. Mother have many Children, How can
If necessity is the mother of invention, I'd like to kill the guy who
Hello I want to make something like a meta language which gets parsed and
I'm writing a TCP chat server ( programming language does not mather ). 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.