Skip to content

Commit

Permalink
fix: 修复针对Adobe Acrobat Pro复制结果多出一个\0的问题 CopyText#890
Browse files Browse the repository at this point in the history
  • Loading branch information
ZGGSONG committed Nov 17, 2024
1 parent 69320bb commit b0c8ba0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/TextCopy/WindowsClipboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ static void TryOpenClipboard()

Marshal.Copy(pointer, buff, 0, size);

return Encoding.Unicode.GetString(buff).TrimEnd('\0');
var result = Encoding.Unicode.GetString(buff);
var nullCharIndex = result.IndexOf('\0');
return nullCharIndex == -1 ? result : result[..nullCharIndex];
}
finally
{
Expand Down

0 comments on commit b0c8ba0

Please sign in to comment.