I use a pie chart using google charts. In my page I load the chart as described in the docs. It's a view in asp.net that renders the output. The view checks if a class called Avstemning is populated then puts strings from that class into the chart as data. But if I use Norwegian letters like ø,æ, å. The chart data can't read it even as I specify the language option to use. What is going on here? If I change the data variable to take hard coded options with norwegian letters it works. But that's not exactly ideal. Any ideas on how to solve this?
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> @if (Model.Avstemning != null) { <script type="text/javascript"> google.charts .load('current', { 'packages': ['corechart'], 'language':'no' }); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Avstemning', '@Model.Avstemning.Tittel'], ['@Model.Avstemning.Option1', @Model.Avstemning.One], ['@Model.Avstemning.Option2', @Model.Avstemning.Two], ['@Model.Avstemning.Option3', @Model.Avstemning.Three] ]); var options = { title: '@Model.Avstemning.Tittel'}; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script> }
My guess is that the strings that populates the javascript code is in another format(?) so the javascript can't translate it to norwegian?