When I display a chart and its title has an apostrophe, the title displays the '
as '
.
How can I prevent this from happening?
When I display a chart and its title has an apostrophe, the title displays the '
as '
.
How can I prevent this from happening?
<script>
var data = [];
var labels = [];
@foreach (var item in Model) {
@:labels.push("@Html.Raw(HttpUtility.JavaScriptStringEncode(item.TitleWithApostrophe))");
}
</script>
More about this question here: Javascript, Razor and Escape characters. Like apostrophe
Have you copied the title from somewhere if so try copying into notepad first then into VS.
If not you may and you are generating it dynamically you may need to make sure you set the encoding on the chart (if there is a setting) to the source encoding