If your GN4 system uses Arabic or Cyrillic characters, problems may arise when an URL is generated for the GNweb.
The URL (path or pattern) and Document alias is wrongly generated, and some characters appear unexpectedly changed. The fact is that some characters are non-standard for URLs and get automatically replaced.
A possible workaround is to add the following key in your web.config file:
<add key="CMSRemoveDiacriticForSafeURLPath" value="false"/>
However, this is only a workaround, and not very safe.
A better solution is to write your own logic for handling diacritics as explained on http://devnet.kentico.com/docs/devguide/index.html?urls_custom_handling_of_path_values.htm.
Sanitizing URL in GN4
Assuming you need to sanitize DocumentUrlPath, use the replace xsl extra function like this:
<!-- regEx expression to be used for generating valid urls (to be improved) -->
<xsl:variable name="regExInvalidChars"><![CDATA[[ '?:\\/*""<>|]]]></xsl:variable>
<DocumentUrlPath>
<xsl:value-of select="concat('/',fn:replace($obj/gn4:title,$regExInvalidChars,'-'))" />
</DocumentUrlPath>
The above will replace the invalid chars with a dash.