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

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
I have a few scripts on a site I recently started maintaining. I get
I know PHP scripts don't actually compile until they are run. However, say I
For writing scripts for process automation in Linux platform, which scripting language will be
Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider
I have two scripts that often need to be run with the same parameter:
I have some ksh scripts which I'd like to convert to run with bash
I have two PHP scripts, both using the same session by calling session_name('MySessID') .

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.