diff options
author | sr55 <[email protected]> | 2015-01-09 21:07:57 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-01-09 21:07:57 +0000 |
commit | e224d30a0d2dad76e501ff5d25e90f1b39c73807 (patch) | |
tree | 1283dc0e67248b3d52f58106afe3e92f5e525e5a /win/CS | |
parent | 5101bcf0a9e071553ac078af6ab986e43027df61 (diff) |
WinGui: Better UTF-8 Fix, Also fixed encode class
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6704 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index a62fb82fe..1e6fe8506 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -492,7 +492,7 @@ namespace HandBrake.Interop };
string encode = JsonConvert.SerializeObject(encodeObject, Formatting.Indented, settings);
- HBFunctions.hb_add_json(this.hbHandle, Marshal.StringToHGlobalAnsi(encode));
+ HBFunctions.hb_add_json(this.hbHandle, InteropUtilities.ToUtf8PtrFromString(encode));
HBFunctions.hb_start(this.hbHandle);
this.encodePollTimer = new System.Timers.Timer();
@@ -605,12 +605,8 @@ namespace HandBrake.Interop this.titles = new List<Title>();
var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);
- // Convert UTF-8 encoded jsonMsg to string
- int length = 0;
- while (Marshal.ReadByte(jsonMsg, length) != 0) length++; // find 0 termination
- byte[] buffer = new byte[length];
- Marshal.Copy(jsonMsg, buffer, 0, buffer.Length);
- string scanJson = Encoding.UTF8.GetString(buffer);
+
+ string scanJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);
JsonScanObject scanObject = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);
lastScan = scanObject;
|