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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:08:34+00:00 2026-05-15T14:08:34+00:00

My scripts are definitely saved in UTF-8. I’m instantiating PDO with {$this->engine}:host={$this->host};dbname={$this->name};charset=UTF-8 . My

  • 0

My scripts are definitely saved in UTF-8. I’m instantiating PDO with "{$this->engine}:host={$this->host};dbname={$this->name};charset=UTF-8". My tables use InnoDB and are collated using utf8_general_ci. My pages are sent either with the Content-Type: text/html; charset=UTF-8 header or the <meta> equivalent.

When using PDO to store a € character originating either from HTTP input or a string literal in the source code, I’m left with c3 a2 e2 80 9a c2 ac according to MySQL Workbench 5.2. Retrieving this from the database and displaying it on the page works fine. Yet in phpMyAdmin and Workbench, I see €.

When using these two tools to store a €, I’m left with e2 82 ac, which is apparently the correct UTF-8 representation, but if I try to retrieve and then output this with PHP, � is displayed.

My question is, from where does this discrepancy arise and is it possible to have my web pages and database tools both work flawlessly?

  • 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-15T14:08:34+00:00Added an answer on May 15, 2026 at 2:08 pm

    The charset directive in the DSN actually applies to MSSQL. I simply needed to execute SET NAMES. Sorry about that.

    I achieved that thus:

    parent::__construct("{$this->engine}:host={$this->host};dbname={$this->name}",
                        $this->user, $this->password,
                        array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have come across scripts that use: isset($_POST['submit']) as well as code that uses:
When developing Pig scripts that use the STORE command I have to delete the
This is part of a script I was working on which definitely returns and
Resource scripts loaded from .rgs files are used with ATL CComModule::UpdateRegistryFromResource() . It's quite
CGI scripts should have access to a list of environment variables set by the
My scripts are running fine on chrome and IE but won't start on firefox
Say I have 2 scripts test1.sh #!/bin/sh . ./test2.sh foo test2.sh #!/bin/sh foo(){ echo
I have two scripts that are called in one program, the first script creates
Whenever I write shell scripts (mostly software development utilities or build tools) I've generally
Now a lot of scripts to facebook-style fetching data from url, but all of

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.