0

英語以外の文字で Moonshine (https://github.com/brandonc/moonshine) を使用する場合 - たとえば、次のテキストを実行する場合

The following is italic Arabic text: *مرحبا، كيف حالك اليوم؟*

パラメータ付きの github プロジェクトで提供されるコンソール アプリを介して

extensions = 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 */
};

受信した出力が正しくエンコードされていないテキストであるため、役に立ちません。

瀼吾栀攀 昀漀氀氀漀眀椀渀最 椀猀 戀漀氀搀 䄀爀愀戀椀挀 琀攀砀琀⼼㹰༊ҧÄȪ

再度、感謝します。

4

1 に答える 1

0

この問題に対する明確な解決策は見つからず、最終的に MarkdownDeep ( https://github.com/toptensoftware/markdowndeep ) に変換しました。これは Moonshine と同様に機能し、UTF8 で適切に動作し、32 ビット モードを使用する必要はありません。アプリ プールに追加するか、アプリをコンパイルして x86 をターゲットにします。

ありがとう
ムスタファ

于 2012-06-14T22:06:13.740 に答える