Mog0
Mog0

Reputation: 2097

How do you force UTF-8 encoding for Win RT WebView

I'm writing a universal app for Windows 8.1 / Windows Phone 8.1 that displays web pages in a Windows.UI.Xaml.Controls.WebView. The pages are encoded in UTF-8 but they are being displayed as 8-bit text.

Is there a way to force the Windows.UI.Xaml.Controls.WebView to interpret the page as UTF-8?

I am loading the pages using NavigateToLocalStreamUri so there are no HTTP headers involved.

If I load the page in Internet Explorer on the desktop then it also treats it as 8-bit text and forcing the encoding using the view menu causes the page to display correctly.

The page itself starts

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html>

so I don't know why IE gets it wrong at all

Any help appreciated.

Upvotes: 0

Views: 789

Answers (1)

Damir Arh
Damir Arh

Reputation: 17855

You could try specifying the encoding in a meta tag in the head of the page:

For HTML 4:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

For HTML 5:

<meta charset="UTF-8">

Upvotes: 2

Related Questions