burger
infomaniak
infomaniak
cloud-computing-logo
Cloud Computing
web-domain-logo
Web & Domains
event-marketing-logo
Events & Marketing
  • Our products
    • Collaborative tools icon chevron
    • Web & Domains icon chevron
    • Cloud Computing icon chevron
    • Events & Marketing icon chevron
    • Streaming icon chevron

      ksuiteCollaborative suite

      Discover the collaborative suite → Discover →
    • kSuite Professional email, sovereign cloud and AI for sustainable performance
    • kSuite The suite for secure communication, storage and sharing
    • kdrive
      kDrive Store, collaborate and share your files
    • mail service
      Mail Service Create your email addresses with your domain
    • kChat
      kChat Communicate live with your teams
    • kmeet
      kMeet Organise your meetings online in complete security
    • swisstransfer
      SwissTransfer Send your files up to 50 GB free of charge.
    • kpaste
      kPaste Share and encrypt your sensitive information
    • ksuite
      Custom Brand Control the brand image of your products
    • kChat
      Chk Link reducer & QR code generator
      Find the web hosting solution you need
    • Domain name
      Domain name Reserve your domain name at the best price
    • Site Creator
      Site Creator Create your website with ease
    • web hosting
      Web Hosting Create your website with over 100 CMS
    • web hosting
      Wordpress Hosting Create your WordPress website easily
    • Cloud Server
      Cloud Server Power up your sites with guaranteed resources
    • Node.js Hosting Create a dynamic, interactive site with Node.js
    • SSL Certificat
      SSL certificates Secure your websites with an EV or DV certificate
    • Options
    • Domain privacy
      Domain Privacy Protect your domains’ private data
    • DNS Fast Anycast
      FastAnycast DNS Speed up your site access times
    • Dyn DNS
      DynDNS Access your devices remotely
    • Dyn DNS
      Renewal Warranty Secure your domains against loss and theft
      Find the right Cloud Computing solution

      Cloud services

    • public cloud
      Public Cloud (IaaS) Create your projects in a high-end, ultra-competitive Cloud
    • Cloud Server
      VPS Cloud Create a Windows / Linux server
    • Kubernetes service Deploy your containerised apps on a large scale.
    • VPS Lite
      VPS Lite Create a Windows/Linux server at a low cost
    • Database Service Manage your databases with a managed solution
    • jelastic cloud
      Jelastic Cloud (PaaS) Create your own customised environments
    • Other services

    • llm api
      AI Tools Boost your productivity with our sovereign AI
    • swiss backup
      Swiss Backup Back up your devices in the Cloud
    • nas synology
      NAS Synology Rent a NAS in our secure data centers
    • High availibility
      Very High Availability Create a multi-data center infrastructure with customised SLAs
    • Housing
      Housing Install your servers in our data centers
    • Auth Add a privacy-friendly login method to your apps
      Infomaniak Events, the independent local events portal
      Online ticketing service with a wide choice of concerts, shows and events.
    • online shop
      Ticketing Create your ticketing service and sell tickets
    • kdrive
      Access Control Control access to your events with ease
    • kdrive
      Guest manager Automate your event invitations
    • kdrive
      Newsletter Send your newsletters at competitive prices
    • Streaming radio
      Streaming radio Create and broadcast your own live radio station online
    • streaming video
      Video-Streaming Create and broadcast live events and TV online
    • VOD and AOD
      VOD & AOD service Host and broadcast your recordings without limits
  • Resources
    documentation icon Documentation
    Guides & tutorials
    API documentation
    special offers icon Special offers
    Get started for free
    Student programme
    Become an affiliate
    partner program icon Partner programme
    Find a partner
    Become a partner
    support icon Support & contact
    Contact Support
    Premium support - 24/7
    Contact our sales department
    Hiring an expert
    Migrate to Infomaniak
  • About us
    forest
    icon Ecological commitment
    We pollute. But we are taking action to reduce the footprint of our services and infrastructure
    Discover our commitment →
    icon About Infomaniak
    Our vision, our values
    Our teams
    Infomaniak is recruiting
    Press and communication
    Blog and news
    icon Security
    Data confidentiality
    Bug Bounty Programme
  • Get started for free
    Sign in
  • search-icon
    close-icon
      icon

      Would your needs exceed our solutions? To find out, contact us so that we can advise you personally.

      Our flagship products:
  • search-icon
  • Get started for free
    Sign in
Price Price
Knowledge base

1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!

Knowledge base Solve a page encoding problem

    Solve a page encoding problem

    This guide is for you if you encounter page encoding issues and unusual characters appearing on your pages.

     

    Universal encoding

    If you encounter page encoding issues, it is important to check that the encoding of your page is set to UTF-8. UTF-8 is a universal encoding that supports most of the characters used around the world. It may happen that some files contain characters incompatible with UTF-8 encoding. In this case, you must convert them to UTF-8 using an appropriate text editor.

    If the HTML page encoding is, for example, in UTF-8 while the database is in latin-1, the accents will not be interpreted correctly by MySQL. If the pages contain special characters (Arabic, Chinese texts, accents), they may display correctly on your website but not in phpMyAdmin, or vice versa...

    Use a text editor capable of saving your files in UTF-8. If you import text files containing SQL code, you must edit them with software that saves in UTF-8.

     

    UTF-8 in PHP

    To force the site headers to UTF-8 using PHP, you can use the header() function with the Content-Type parameter. Here is an example of code that forces character encoding to UTF-8:

    <?php
    header('Content-Type: text/html; charset=utf-8');
    ?>

     

    UTF-8 via .htaccess

    To force character encoding to UTF-8 via your site's .htaccess file, for HTML content add:

    AddDefaultCharset utf-8
    Header set Content-Type "text/html; charset=utf-8"

    and for PHP content, add:

    php_value default_charset UTF-8
    php_value mbstring.internal_encoding UTF-8

     

    UTF-8 in HTML

    To specify the character encoding in UTF-8 in the HTML code, you can use the meta tag charset:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Titre de la page</title>
    </head>
    <body>
    <!-- Contenu de la page -->
    </body>
    </html>

    Make sure that all files used on your website, such as CSS style sheets and JavaScript scripts, are also encoded in UTF-8. This ensures that all characters on your website will be displayed correctly.

     

    UTF-8 in database

    To (re)declare the encoding of databases and tables in UTF-8 in phpMyAdmin, you can follow these steps:

    1. Log in to your phpMyAdmin control panel.
    2. Click on the "Operations" tab at the top.
    3. In the "Table Options" section, look for the "Collation" line and click on the dropdown button.
    4. Select a collation option that uses UTF-8 encoding, for example utf8_general_ci.
    5. Click on the "Run" button at the bottom of the page to save the changes.

    Add the PHP function mysql_set_charset to the connection created by mysql_connect to determine the encoding of this connection (if you do not specify it, the default value of this parameter may vary from one server to another):

    $connection = mysql_connect($server, $username, $password);
    mysql_set_charset('utf8', $connection);

    You can also change this default parameter for your entire hosting by following this documentation.

    Once the MySQL connection is established from a PHP script, you can also specify the UTF8 charset type with these commands:

    mysql_query("SET NAMES 'utf8';");
    mysql_query("SET CHARACTER SET 'utf8';");

     

    Accents / Special Characters

    When you retrieve a backup of your MySQL database (called a "dump") and import it into your own database, it may happen that accents (like é, à, ô) appear as strange symbols, such as question marks (for example "?" instead of an accent).

    This happens because MySQL backups are generally created using a special format called UTF-8. In this format, letters with accents use more space (they are encoded on two bytes, a bit like two "units" of data per character). On servers, this works well, but if you are working on your personal computer, you may need to adjust some configurations so that the import is done correctly using UTF-8. The issue of strange characters generally occurs when there is a mismatch in encoding between the backup file and the import. This can happen if the file is encoded in one format (for example UTF-8) but MySQL expects another encoding (for example latin1).

    Here are some solutions:

    • Convert the file: You can convert the backup file from UTF-8 to another format, called latin1, before importing it into your database. This can prevent accents from being misinterpreted but it has limitations. If the file contains characters that cannot be represented in latin1 (such as certain special or non-European characters), you risk losing these characters during the conversion. Therefore, this is a solution to be used with caution, and it depends on the type of data present in your SQL file.
    • Specify the correct format during import: If you haven't converted the file, you can indicate during import that the file is in iso-latin1 format (when importing an SQL file, you can explicitly specify that the file is in ISO-8859-1, also known as latin1). This aligns the file's encoding with what MySQL expects, which usually resolves the issue of incorrectly displayed characters.

    If you see question marks instead of accents, it probably means that the backup file is in a format other than UTF-8, but your software is trying to import it as if it were in UTF-8. To avoid this, on Linux, you can use a command called iconv to convert the file to UTF-8 before importing. This ensures that the encoding is consistent with MySQL's expectations.



    Link to this FAQ:
    Has this FAQ been helpful?
    Thank you for your feedback. Improve this FAQ?
    Please do not ask any questions through this form, it is only used to improve our FAQ.
    Please use our contact form for any question.
    Your message has been sent. Thank you for suggesting an improvement to this FAQ.
    Display all FAQs for this product
    logo infomaniak
    Prices do not include VAT
    facebook
    twitter
    linkedin
    instagram

    Infomaniak

    About Infomaniak The team Infomaniak is recruiting Press space Infomaniak blog All certificates Products and offers Clients' opinions

    Support

    Assistance 7/7 FAQ and guides Premium Support Sales contact API REST Report abuse WHOIS Statuts Public Cloud Service status

    Partnerships

    Become a reseller Affiliate programme Directory of partners Requests for quotes

    Ecology

    Green hosting Certificates & awards

    Follow our development

    The email entered is invalid
    earth icon
    • EN
      • EN
      • DE
      • ES
      • FR
      • IT
    ©2025 Infomaniak - Legal documents - Legal notice - Data Protection - Privacy Policy - Site map - Manage your cookies
    icann-logo
    swiss
    new-iso
    swiss-hosting
    logo infomaniak
    Prices do not include VAT

    Infomaniak

    About Infomaniak The team Infomaniak is recruiting Press and media Infomaniak blog All certificates Products and offers Clients' opinions

    Support

    Assistance 7/7 FAQ and guides Premium Support offer Sales contact API REST Report abuse WHOIS Statuts Public Cloud Service status

    Partnerships

    Become a reseller Affiliate programme Directory of partners Requests for quotes

    Ecology

    Green hosting Certificates & awards

    Follow our development

    The email entered is invalid
    icann-logo
    swiss
    new-iso
    swiss-hosting

    facebook
    twitter
    linkedin
    instagram
    ©2025 Infomaniak
    Contracts - Legal notice - Data Protection - Privacy Policy - Site map - Manage your cookies

    Managers

    earth icon
    • EN
      • EN
      • DE
      • ES
      • FR
      • IT
    Your browser is outdated, security and browsability are no longer guaranteed. We recommend that you update it as soon as possible by clicking here.