ASP.NET MVC3 razor problem with international characters in custom html helpers -
i trying convert asp.net mvc2 application asp.net mvc3 razor. have lot custom html helper methods, render html output, 1 below, renders button markup :
stringbuilder sb = new stringbuilder("<input type='submit' id='") .append(buttonid) .append("' name='" ) .append(buttonid) .append("' value='") .append(buttonvalue) .appendline("' class='myclass1 myclass2' />"); return mvchtmlstring.create(sb.tostring());
when buttonvalue contains international characters é or ë, text of button gets rendered wrong, guess kind of encoding occurs...
eg. ë changed ë
i know, mvc3 uses kind of templating system html helpers, have lot of own helpers take time know , change current custom helpers.
problem solved, apparently had encoding of cshtml files, generated small c# program tries convert webform syntax razor syntax. when writing resulting cshtml file, if forgot specify encoding parameter, resulted in different encoding of cshtml file compared original aspx or ascx file. solved changing
file.writealltext(filename,text)
to
file.writealltext(filename, text,encoding.default)
Comments
Post a Comment