#43 DNBridge does not handle ANSI chars > 127

v5.3
open
nobody
ALL (19)
5
2005-04-12
2005-04-12
MikeB
No

A .NET plugin that needs to handle ANSI characters in
the range 128 to 255, including the $CustomChar's,
gets corrupted characters. The problem is that the
DNBridge does not convert to UTF8 when calling the
custom DLL and does not convert the high end
characters that are returned.

The issue is that characters above 127 in UTF8 have a
two character pair starting with 194 or 195 and then a
character 128-129.

As an example a plugin that returns a string containing
an e-accute character returns 195:169 and not 233 and
Smartie displays this as two characters (A-tilda and
copywrite). DNBridge assumes 7 bit ASCII strings and
not 8 bit ANSI and treats them as UTF8.

The attached code is a standard C++ (non .NET) plugin
with function 2 converting the UTF8 string to ANSI. This
is my workaround, but is cumbersome. It would be
better if this code could be added to DNBridge in the
buffer returned from BridgeFunc. It would also be good
to carry out the reverse conversion with the params on
the way in.

Discussion

  • MikeB
    MikeB
    2005-04-12

    mcix c++ Smartie plugin with UTF8 to ANSI conversion

     
    Attachments
  • MikeB
    MikeB
    2005-06-12

    Logged In: YES
    user_id=1257465

    I have provided a patched version of DNBridge at
    http://www.axcis.com.au/shop/index.php?
    main_page=product_info&cPath=2&products_id=6

     
  • Chris Lansley
    Chris Lansley
    2005-06-12

    Logged In: YES
    user_id=1114156

    Thanks! I have to attempt that I had no idea what I was
    doing whilst creating dnbridge - I'm glad to receive any
    changes you want to make.

    I will apply your changes as soon as I have some spare time.

    Thanks!

     
  • MikeB
    MikeB
    2005-06-13

    Logged In: YES
    user_id=1257465

    The original DNBridge works great and I have just fixed an
    odd quirk with UTF8. This is only needed for special
    characters.

     
  • Chris Lansley
    Chris Lansley
    2005-10-31

    Logged In: YES
    user_id=1114156

    Hi Mike, Are you happy to make your changes open-source?
    I.e. Am I able to add the changes to the LCD Smartie code base?

    [I've finally found some spare time!]

     
  • MikeB
    MikeB
    2005-10-31

    Logged In: YES
    user_id=1257465

    Yes, I am happy for my changes to be open-source.

    Mike.