The previous version of PHPBB used this code to construct a connection string and connect to a MSSQL database inside mssqlnative.php:
The latest release of PHPBB adds a UTF-8 characterset declaration line:
When I upgraded my site, every post on the site which included Unicode characters started showing invalid character sequences in place of the proper character. For instance, instead of the opening quote character “ the site would show the UTF-8 character sequence â€œ.
The post_text column in the phpbb_posts table stores that character in the post using the encoded UTF-8 character sequence â€œ. This is sent directly to the browser as is, declaring the page to be UTF-8, and the browser correctly displays the Unicode character.
By declaring the connection to the SQL Server as UTF-8, the connection/SQL Server encodes the already encoded UTF-8 character sequences that are stored in the post_text column. This is output to the browser, which decodes the second encoding, but then displays the post directly as it is stored in the database - which is still encoded.
Removing this CharacterSet parameter from the connection string stops the double UTF-8 encoding from occurring and returns proper functionality to the site under SQL Server.