I managed to get the self signed certificate to work - Thanks for helping me out at GitHub.
However, I have another problem... this does not work:
Code:
#include <sourcemod>
#include <ripext>
public void OnPluginStart()
{
PrintToServer("Testing JSONObject...");
JSONObject obj = new JSONObject();
obj.SetString("test", "ð");
decl String:test[10];
obj.GetString("test", test, sizeof(test));
delete obj;
PrintToServer("test: %s", test);
PrintToServer("Finished testing JSONObject");
}
What the server responds is this:
Code:
sm plugins load test
Testing JSONObject...
L 07/13/2018 - 11:35:58: [SM] Native "JSONObject.GetString" reported: Could not retrieve value for key 'test'
L 07/13/2018 - 11:35:58: [SM] Displaying call stack trace for plugin "test.smx":
L 07/13/2018 - 11:35:58: [SM] [0] Line 10, test.sp::OnPluginStart()
[SM] Loaded plugin test.smx successfully.
I am trying to send player name to a REST API. It seems some player names fail to work with the JSONObject. Not always though, and that is what I don't quite understand. I am thinking base64 encoding the names, but I was hoping there was a better solution for this.
Here's another example:
Code:
#include <sourcemod>
#include <ripext>
public void OnPluginStart()
{
PrintToServer("Testing JSONObject...");
JSONObject obj = new JSONObject();
obj.SetString("test1", "We start here...");
obj.SetString("test2", "ð");
obj.SetString("test3", ".. and here we are");
decl String:json[64];
obj.ToString(json, sizeof(json));
delete obj;
PrintToServer("json: %s", json);
PrintToServer("Finished testing JSONObject");
}
What the server responds is this:
Code:
sm plugins load test
Testing JSONObject...
json: {"test1": "We start here...", "test3": ".. and here we are"}
Finished testing JSONObject
[SM] Loaded plugin test.smx successfully.
__________________