Error with Special Characters - Microsoft SQL Server Management Studio

Lucas Carminati 20 Reputation points
2023-06-14T02:48:51.4233333+00:00

I have a database that when I open it, some data with accents appear with an error, an icon with a question mark appears. I tried to find solutions on the internet but I didn't find anything. I need to fix this problem and show the accent correctly without changing the database, without removing the accent.

I attached a database image with the error:

Error_example.png

SQL Server Other
{count} votes

Accepted answer
  1. Anonymous
    2023-06-14T06:49:12.6166667+00:00
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2023-06-14T05:16:27.62+00:00

    a question mark appears.

    That happens if you have Unicode text, with can't presented as ASCII with oyur used collation (code page), for

    example.

    SELECT N'ภาษาไทย', 'ภาษาไทย'
    
    

    The second column shows ???.

    So your database don't match your requirements to store Unicode. Change data type for varchar (ANSI) to Nvarchar = Unicode; a lot of work.

    0 comments No comments

  2. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-06-14T22:03:28.55+00:00

    The character you see is known as REPLACEMENT CHARACTER. Typically you see it when UTF-8 is expected, but the character is not part of a legal UTF-8 sequence.

    To get the character correct, you may need to do something like:

    SELECT cast(cast(col AS varbinary(100)) AS varchar(100) COLLATE Latin1_General_100_CI_AS))
    FROM  tbl
    

    But the hour is late here, and I don't have time to test.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.