URLSegment character mapping

Vote:
 

Hi,

we need to have different mappings for the urlsegment depending on which language is edited. Is there a way to configure this somehow? And also, is there a way to add like "oe" as replacement for "ö"? Today UrlSegment.URLCharacterMap is a char[,] which means that's a problem.

Thanks,
Erik

Ps. I have solved this issue with some nasty code, just want to know if there is a best practice I'm missing out on.. :)

#121912
May 20, 2015 12:37
Vote:
 

Hi,

I believe you can set the UrlSegment.URLCharacterMap to override the replacement characters, no? It's just a Hastable with set access.

Regards.

/Q

#121914
May 20, 2015 13:22
Vote:
 

Hi Quan,

I tried that, but if i add/change to a string instead of a char as replacement, I get a cast exception later on.

/Erik

#121915
May 20, 2015 13:30
Vote:
 

I guess it's in internal static string ReplaceIllegalChars(string inputString) it happens.

#121916
May 20, 2015 13:32
Vote:
 

Hi,

The URLCharacterMap.URLCharacterMap is a public static property. You could try to setup it somewhere in your bootstraper.

#121917
May 20, 2015 13:37
Vote:
 

Hmm, so instead of mapping character-character you want character-string instead.

I have tried yet but I think you can overwrite the default ContentProvider.GetUniqueUrlSegment and do the stuff here. It calls to UrlSegment.GetUrlFriendlySegment, which unfortunately un-overridable. 

Just not sure if this approach is even nastier than yours :).

Regards.

/Q

#121921
May 20, 2015 13:43
Vote:
 

Hmm, so instead of mapping character-character you want character-string.

I have tried yet but I think you can overwrite the default ContentProvider.GetUniqueUrlSegment and do the stuff here. It calls to UrlSegment.GetUrlFriendlySegment, which unfortunately un-overridable. 

Just not sure if this approach is even nastier than yours :).

Regards.

/Q

#121922
May 20, 2015 13:43
Vote:
 

Hehe, I think I'll stick to the current solution. It ignores ä,ö,ü and ß in the character mapping, then in UrlSegment.CreatedUrlSegment I replace them myself with ae, oe, ue and ss.

/Erik

#121923
May 20, 2015 13:50
* 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.