如果我在非英文字符上使用 Moonshine (https://github.com/brandonc/moonshine) - 例如,如果我运行以下文本
The following is italic Arabic text: *مرحبا، كيف حالك اليوم؟*
通过 github 项目中提供的带有参数的控制台应用程序
扩展 = Sundown.MarkdownExtensions.NoIntraEmphasis | Sundown.MarkdownExtensions.FencedCode | Sundown.MarkdownExtensions.AutoLink smartypants = false
输出是:
<p>The following is italic Arabic text: <em>?????? ??? ???? ??????</em></p>
我怎样才能让它正确地传回去?
谢谢
穆斯塔法
编辑:
所以我注意到在 Moonshine.cs 包装器中,传递给 Sundown 库的缓冲区是这样定义的:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct buf
{
[MarshalAs(UnmanagedType.LPStr)]
public string data; /* actual character data */
public uint size; /* size of the string */
public uint asize; /* allocated size (0 = volatile buffer) */
public uint unit; /* reallocation unit size (0 = read-only buffer) */
public int @ref; /* reference count */
};
其中Charset
被定义为Ansi
并且string data
被封送为LPStr
. 不幸的是,将其更改为
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
struct buf
{
[MarshalAs(UnmanagedType.LPWStr)]
public string data; /* actual character data */
public uint size; /* size of the string */
public uint asize; /* allocated size (0 = volatile buffer) */
public uint unit; /* reallocation unit size (0 = read-only buffer) */
public int @ref; /* reference count */
};
没有帮助,因为现在收到的输出是错误编码的文本:
瀼吾栀攀 昀漀氀氀漀眀椀渀最 椀猀 戀漀氀搀 䄀爀愀戀椀挀 琀攀砀琀⼼㹰༊ҧÄȪ
再次感谢。