Convert scandinavian characters (for SEO)

Vote:
 
Anyone this kind of work in EPiServer? We need to convert all characters like æøåöä and so on, into their respective HTML code. One example is the character 'æ' which becomes &ealig;. It would be nice to do this job in the database on the property values, and also make the HTML editor in Edit mode convert these characters automatically when saving pages. Give me a note if you've done this kind of work. Frank :)
#12546
Mar 13, 2006 12:49
Vote:
 
I would think twice before changing the data in the database especially not the longstring properties because they include a lot of codes for the editor to work. This is washed away when rendered to the browser if you use the XHTML editor, the data in the database is not XHTML. I would go for a method were you do the converting when rendered to the browser. There is several ways to do that depending on architecture of the system. One easy way would to override render method on a subclass from EPiServer.TemplatePage. And do the HTMLEncoding there before sending it to the response. Another way could be to inherit from EPiServer.WebControls.Property and override method AddedControl and switch on InnerProperty.Type and do work depending on PropertyDataType Example: protected override void AddedControl(System.Web.UI.Control control, int index) { base.AddedControl(control, index); switch(this.InnerProperty.Type) { case PropertyDataType.String : Label lbl = control as Label; if(lbl != null) { lbl.Text = System.Web.HttpContext.Current.Server.HtmlEncode(lbl.Text); } break; } } Code not verified! /HAXEN
#14478
Mar 14, 2006 13:17
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.