Skip to content

Clipboard error: String conversion error: Illegal byte sequence encounted in the input #15511

Open
@xthinh

Description

@xthinh

Dear All
I have try this code to copy some unicode text:

static void Main(string[] args)
{
if (Clipboard.ContainsText())
{
string st = "";
try
{
st = Clipboard.GetText();
Clipboard.SetText("");
Console.WriteLine(st);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}

But when I copy a string like this:
"Little ghé thăm trường Đại học Quân đội Hoàng gia Saint-Jean (Royal Military College Saint-Jean) bên bờ sông Richelieu, nằm cách Montreal bốn mươi km về phía Nam"
to clipboard then when i run the program, the following error has been thrown:
"String conversion error: Illegal byte sequence encounted in the input."

What should I do to resolve this error?

My system is:
OpenSUSE Leap 15.1, KDE
Mono 5.10.1.47
MonoDevelop 7.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions