首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >月光(用于日落C库的.NET标记包装器)没有正确处理非英语字符

月光(用于日落C库的.NET标记包装器)没有正确处理非英语字符
EN

Stack Overflow用户
提问于 2012-05-30 13:09:29
回答 1查看 228关注 0票数 0

如果我对非英语字符使用月光(https://github.com/brandonc/moonshine) --例如,如果我运行以下文本

代码语言:javascript
复制
The following is italic Arabic text: *مرحبا، كيف حالك اليوم؟*

通过github项目中提供的带有参数的控制台应用程序

扩展名= Sundown.MarkdownExtensions.NoIntraEmphasis \x\ Sundown.MarkdownExtensions.FencedCode \ Sundown.MarkdownExtensions.AutoLink智能类型= false

产出如下:

代码语言:javascript
复制
<p>The following is italic Arabic text: <em>?????? ??? ???? ??????</em></p>

我怎样才能让它正确地传回呢?

谢谢

穆斯塔法

编辑

因此,我注意到在Moonshine.cs包装器中,传递给Sundown库的缓冲区定义为:

代码语言:javascript
复制
[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被定义为Ansistring data被封送为LPStr。不幸的是,把它改为

代码语言:javascript
复制
[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 */
};

没有帮助,因为现在接收到的输出被错误编码的文本:

代码语言:javascript
复制
瀼吾栀攀 昀漀氀氀漀眀椀渀最 椀猀 戀漀氀搀 䄀爀愀戀椀挀 琀攀砀琀⼼㹰༊ҧÄȪ

再次感谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-14 22:06:13

我们从来没有找到一个干净的解决方案,并最终转换为MarkdownDeep ( https://github.com/toptensoftware/markdowndeep ),它的性能类似于Moonshine,在UTF8上运行良好,并且不需要我们在App上使用32位模式,也不需要编译我们的应用程序来针对x86,这对我们来说更好。

谢谢

穆斯塔法

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10816971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档