Skip to content

Commit c9766d1

Browse files
author
SPM
committed
Double to str conversion fix
Forced en-US locale when converting double to string to ensure that . (dot) is used as delimiter. InfluxDB won't accept anything else than dot regardless on current locale.
1 parent d1faa85 commit c9766d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

AdysTech.InfluxDB.Client.Net/InfluxDBClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public async Task<bool> PostValueAsync(string dbName, string measurement, long t
254254
new KeyValuePair<string, string>("precision", precisionLiterals[(int) precision])
255255
}).ReadAsStringAsync ();
256256

257-
var content = String.Format ("{0},{1} {2}={3} {4}", measurement, tags, field, value, timestamp);
257+
var content = String.Format (System.Globalization.CultureInfo.GetCultureInfo("en-US"), "{0},{1} {2}={3} {4}", measurement, tags, field, value, timestamp);
258258
ByteArrayContent requestContent = new ByteArrayContent (Encoding.UTF8.GetBytes (content));
259259
HttpResponseMessage response = await PostAsync (builder, requestContent);
260260

@@ -295,7 +295,7 @@ public async Task<bool> PostValuesAsync(string dbName, string measurement, long
295295
// content.AppendFormat ("{0},{1} {2} {3}\n", measurement, tags, value, timestamp);
296296
////remove last \n
297297
//content.Remove (content.Length - 1, 1);
298-
var valuesTxt=String.Join (",", values.Select (v => String.Format ("{0}={1}", v.Key, v.Value)));
298+
var valuesTxt=String.Join (",", values.Select (v => String.Format (System.Globalization.CultureInfo.GetCultureInfo("en-US"), "{0}={1}", v.Key, v.Value)));
299299
var content = String.Format ("{0},{1} {2} {3}", measurement, tags, valuesTxt, timestamp);
300300

301301
ByteArrayContent requestContent = new ByteArrayContent (Encoding.UTF8.GetBytes (content.ToString ()));

0 commit comments

Comments
 (0)