Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Not able to pass json in UTF-8-BOM #49

Closed
AdamMachera opened this issue Nov 8, 2016 · 2 comments
Closed

Not able to pass json in UTF-8-BOM #49

AdamMachera opened this issue Nov 8, 2016 · 2 comments
Assignees
Labels

Comments

@AdamMachera
Copy link

If file path is passed to json that is encoded as UTF-8-BOM to method
GATEWAY_HANDLE Gateway_CreateFromJson(const char* file_path)
no gateway is created (LogError("Input file [%s] could not be read.", file_path);).

I did this test in from .NET code (because VS by default adds BOM)

To make it happen I extended dotnet.cpp

MODULE_EXPORT GATEWAY_HANDLE Module_Gateway_CreateFromJson(const char* file_path)
{
return Gateway_CreateFromJson(file_path);
}

MODULE_EXPORT void Module_Gateway_Destroy(GATEWAY_HANDLE handle)
{
Gateway_Destroy(handle);
}

and I consume those method from c#:
[DllImport(@"dotnet.dll", EntryPoint = "Module_Gateway_CreateFromJson", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr GatewayCreateFromJson([MarshalAs(UnmanagedType.LPStr)] string filePath);

    [DllImport(@"dotnet.dll", EntryPoint = "Module_Gateway_Destroy", CallingConvention = CallingConvention.Cdecl)]
    public static extern IntPtr GatewayDestroy(IntPtr gateway);
@andrew-buckley
Copy link
Contributor

Hi @AdamMachera, this is actually due to an issue with one of our dependencies that we use to read JSON configs. I've opened an issue with there that you can see here.

@damonbarry
Copy link
Member

Parson was updated to read files with UTF-8 BOM. The gateway updated it's submodule reference to parson (98f8aae). So this issue should be fixed in the latest code on the develop branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants