2

I am trying to encode German characters in html. I just want to use the special character codes. For the Umlaut, I've tried using both Ü and Ü and neither renders properly. What am I doing wrong? Thanks.

This is for a Squarespace site, and I am inserting Javascript into their Code Injection page, into the footer. I am using Javascript to write a German word on the page. The relevant part of my code looks like the below. And the problem is that this simply renders "& U uml;ber' (space added by me because the umlaut renders properly on Stack Overflow without it) on the page rather than Uber with an umlaut. Thanks!

 var strings = {
          'About': {
            'de': 'Über'
          },
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Keren
  • 217
  • 1
  • 6
  • 20

2 Answers2

5

Try using Ü for the German character Ü.

You need to escape special characters in HTML, unless...

You address the encoding issue on a document-wide level by adding the following line of code at the beginning of the <head> section:

<meta charset="utf-8">

Then you don't need to escape special characters individually.


Further reading:


UPDATE 1 (Javascript)


UPDATE 2 (Squarespace)

Community
  • 1
  • 1
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
  • I am using Ü but it doesn't render as an Umlaut. Specifically, I want to use this within Javascript to change text on the page. Is that any different? Thanks! – Keren Sep 27 '15 at 20:15
  • Your question didn't mention Javascript, so I was focused solely on HTML. I have revised my answer with Javascript guidance. – Michael Benjamin Sep 27 '15 at 20:31
  • Did you get it to display properly? – Michael Benjamin Sep 29 '15 at 11:10
  • No. The whole Squarespace site is being delivered through a Content Delivery Network (Amazon's) so I think that may be interfering with how the characters are displayed. Any ideas? Thanks for asking :) – Keren Oct 04 '15 at 21:54
  • Hi @Keren, I think I've exhausted all options as a non-customer of Squarespace. However, if you visit their website you'll find they provide 24/7 customer support. Why not contact them directly? I didn't notice any free plans, so I presume you're paying them. Put them to work! ;-) – Michael Benjamin Oct 04 '15 at 22:49
  • Hi @Michael_B. I did contact them directly---they don't help with this sort of coding stuff. Thanks for all your help! – Keren Oct 05 '15 at 10:09
  • Such a pesky problem! :-) At this point, I would start looking for other German-language sites built on the Squarespace platform and see how they do it. Doesn't even have to be German. Just any Squarespace site showing special characters. – Michael Benjamin Oct 05 '15 at 11:17
1

This solution worked for me. Use the hex code but eliminate the &# from the beginning and add a /

So, to render the word "Über" within Javascript in Squarespace, use /xdcber

Keren
  • 217
  • 1
  • 6
  • 20