Invalid byte sequence when using PostgreSQL and a language other than English is active

Created on 15 April 2009, almost 16 years ago
Updated 14 June 2023, almost 2 years ago

I get this error from drupal everytime I access a page with a blog entry:

# warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0x97 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". in /local/var/www/drupal-6.10_postgresql/includes/database.pgsql.inc on line 139.
# user warning: in /local/var/www/drupal-6.10_postgresql/modules/locale/locale.module on line 365.

# warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0x97 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". in /local/var/www/drupal-6.10_postgresql/includes/database.pgsql.inc on line 139.
# user warning: in /local/var/www/drupal-6.10_postgresql/modules/locale/locale.module on line 381.

I can reproduce this problem on different drupal installations and with different languages activated so I think it has to be something with the blog module and not the translations.

To reproduce:

  1. use postgresql 8.3.x
  2. activate blog module
  3. create a blog entry
  4. install and activate as default a language other than english. (I have try this with the spanish and danish translations)
  5. access any page that shows a blog entry

Any ideas? This is a big problem on busy sites because every page view with blog entries generates error entries by the dblog module

πŸ› Bug report
Status

Needs work

Version

9.5

Component
PostgreSQL driverΒ  β†’

Last updated 7 days ago

No maintainer
Created by

πŸ‡³πŸ‡΄Norway ralfm

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡·πŸ‡ΊRussia Chi

    On my localhost (Apache2, PHP 8.2, Postgres 15) visiting path like /node/%fa gives me the error described in #12.

  • πŸ‡³πŸ‡±Netherlands daffie

    @Chi, I would like to fix this. Would it be possible to write a simple test for this. Or give a more precise description for how to get this error.

  • πŸ‡·πŸ‡ΊRussia Chi

    give a more precise description for how to get this error

    Just open /node/%fa path on any Posgres powered site.

  • last update almost 2 years ago
    Custom Commands Failed
  • πŸ‡·πŸ‡ΊRussia Chi

    Fixed code style issue.

  • last update almost 2 years ago
    29,429 pass, 2 fail
  • πŸ‡¨πŸ‡¦Canada andrew.wang

    This appears to still be an issue in Drupal 10.3.10 / PostgreSQL 16.1.

  • πŸ‡ΈπŸ‡°Slovakia poker10

    I confirm this is still an issue in Drupal 11.1.1 / PostgreSQL. It is sufficient to visit the URL /%c0 to get this error (tested on Drupal CMS). We have a lot of these errors in the log on various sites.

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding "UTF8": 0xc0 0x20: SELECT "base_table"."id" AS "id", "base_table"."path" AS "path", "base_table"."alias" AS "alias", "base_table"."langcode" AS "langcode" FROM "path_alias" "base_table" WHERE ("base_table"."status" = :db_condition_placeholder_0) AND ("base_table"."alias"::text ILIKE :db_condition_placeholder_1) AND ("base_table"."langcode" IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) ORDER BY "base_table"."langcode" ASC NULLS FIRST, "base_table"."id" DESC NULLS LAST; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => /οΏ½ [:db_condition_placeholder_2] => en [:db_condition_placeholder_3] => und ) in Drupal\path_alias\AliasRepository->lookupByAlias() (line 94 of core/modules/path_alias/src/AliasRepository.php).
    
    Drupal\Core\Database\StatementWrapperIterator->execute() (Line: 658)
    Drupal\Core\Database\Connection->query() (Line: 240)
    Drupal\pgsql\Driver\Database\pgsql\Connection->query() (Line: 520)
    Drupal\Core\Database\Query\Select->execute() (Line: 145)
    Drupal\pgsql\Driver\Database\pgsql\Select->execute() (Line: 94)
    Drupal\path_alias\AliasRepository->lookupByAlias() (Line: 131)
    Drupal\path_alias\AliasManager->getPathByAlias() (Line: 37)
    Drupal\path_alias\PathProcessor\AliasPathProcessor->processInbound() (Line: 70)
    Drupal\Core\PathProcessor\PathProcessorManager->processInbound() (Line: 142)
    Drupal\redirect\EventSubscriber\RedirectRequestSubscriber->onKernelRequestCheckRedirect() (Line: 246)
    Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
    Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
    Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 159)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    
  • πŸ‡«πŸ‡·France jibus

    Just got again the error today and a bot crash my drupal website.

  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    Adding a tag.

Production build 0.71.5 2024