如果我对非英语字符使用月光(https://github.com/brandonc/moonshine) --例如,如果我运行以下文本
The following is italic Arabic text: *مرحبا، كيف حالك اليوم؟*通过github项目中提供的带有参数的控制台应用程序
扩展名= Sundown.MarkdownExtensions.NoIntraEmphasis \x\ Sundown.MarkdownExtensions.FencedCode \ Sundown.MarkdownExtensions.AutoLink智能类型= 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 */
};没有帮助,因为现在接收到的输出被错误编码的文本:
瀼吾栀攀 昀漀氀氀漀眀椀渀最 椀猀 戀漀氀搀 䄀爀愀戀椀挀 琀攀砀琀⼼㹰༊ҧÄȪ再次感谢。
发布于 2012-06-14 22:06:13
我们从来没有找到一个干净的解决方案,并最终转换为MarkdownDeep ( https://github.com/toptensoftware/markdowndeep ),它的性能类似于Moonshine,在UTF8上运行良好,并且不需要我们在App上使用32位模式,也不需要编译我们的应用程序来针对x86,这对我们来说更好。
谢谢
穆斯塔法
https://stackoverflow.com/questions/10816971
复制相似问题