Wednesday, November 17, 2010

Foreign characters in strings

I have been finish a couple of custom workflows for FIM 2010 lately and have had some troubles with my national characters (almost always a big problem being Danish :-))

The problem was that when I passed a string with danish characters (or might even be non-default characters for that matter), the result looked strange in the portal. I wanted to use the UpdateResourceActivity activity to set a DisplayName and passed a string as a value with my name, but I ended up with a strange result in the portal -

Result: S#248;ren Granfeldt
Expected result: Søren Granfeldt

Some nice guys helped me out though (see forum thread here, if you're interested). I found the solution to be that you, for some strange reason, need to HtmlDecode your string; so I do this using the following lines -

OutputValue = System.Web.HttpUtility.HtmlDecode(this.ResolvedExpression);

Hope that this helps other non-english custom workflow coding guys (and girls)...

No comments: