我最近made a post here(現在標記爲「回答」 - 它是)將Google Calc json字符串解析爲WP7 http://www.google.com/ig/calculator?hl=en&q=100GBP=?SEK。WP7 Json串行器不處理「空間」?
它的工作的偉大 - 除非谷歌返回上述999多家以上的999的號碼writenn ,而不是。看起來「空間」使得應用程序崩潰/嘗試捕獲意識到有什麼問題。
我只是想知道如何讓json序列化程序(使用System.Runtime.Serialization.Json;)(使用StringBuilder)返回999以上的總和/金額(s),而不會崩潰?
謝謝:)
CODE:
您好!我主要是用在這裏找到的代碼:Parse Google Calculator with Json in Windows Phone 7/C#?
爲了從列表框中獲取貨幣landcodes,我使用:
ListBoxItem toExchangeSelected= toCurrencyList.ItemContainerGenerator.ContainerFromItem(this.toCurrencyListtaListe.SelectedItem) as ListBoxItem;
string toCurrency = toCurrencyList.Content.ToString();
ListBoxItem fromExchangeSelected= fromCurrencyList.ItemContainerGenerator.ContainerFromItem(this.fromCurrencyList.SelectedItem) as ListBoxItem;
string fromCurrency = fromExchangeSelected.Content.ToString();
一觀察是這不是普通的0x20空間。所以可能存在編碼問題。序列是'c2 a0',它是U + 00A0的UTF-8 NO-BREAK空間 – CodesInChaos
我無法再現此問題(即使當使用
AnthonyWJones
你有沒有嘗試過使用另一個解析器,如json.net?如果它確實是我們解析問題而不是轉換問題,請嘗試json.net。 –