My website cannot show æ, ø, å correctly. Have tryed help informations (meta tags)

Thanks, I wil try. But my index file is an exact copy from another website - and there it is showing æ, ø, å correctly. Why?

Because the file encoding and the Operating System used by the server are contributing factors. Linux cannot encode files which use Windows encoding and will return ? Instead.

9 Likes

Hi,

Welcome to the forum. The W3 recommends 3 things:

  1. Save the data as UTF-8 (this is the part you need to do!)
  2. Declare the encoding in your page (you are using ISO-8859-1 but can switch to UTF-8)
  3. Test by using this URL: W3C I18n Checker
7 Likes

Thanks for your help. I will try when I get my FTP connection working. Have worked before, but now it stops so I cannot transfer files. No change of settings. ???

Message:
Startdir=
Socket error: 10154
Connection timeout

I don’t know what FTP client you’re using and with what settings, so I don’t know what that error means.

We recommend FileZilla instead. Not just because it’s a good, free, cross-platform FTP client, but also because it has quite good logging for troubleshooting:

6 Likes

Hi Hilbert,

Normally this can be resolved via having all system, FTP and file encodings set to UTF-8, but in case you’re having difficulties doing that there’s another solution.

Replace all instances of special characters like æ, ø, å using Unicode character reference. As these references only use ASCII space of the character set, you can preserve all character displays using this method regardless of the encoding you used. Just make sure you have a line of <meta charset="utf-8" /> in your HTML code.

For your convenience, the characters you need include:
æ&aelig;
ø&oslash;
å&aring;

You can look at your character from this website using the search function and copy the reference in either columns (the above is taken from the HTML column):

You can also do “Find and replace” in your code editor so you need not search through the entire codebase, VSCode is a good tool for this purpose (and coding overall) as well.

Cheers!

6 Likes

Thanks a lot. I got my Ftp working, and got æ, ø, å correct on my main page. I would rather not have to convert all æ, ø, å to unicode, as I have many files in subdirectories.
Is there another way to make these work - htaccess perhaps - and how?
Kind regards

2 Likes

Hi Hilbert,

VSCode offers a feature called “Search in Folder”, which supports wildcards as well. You can easily replace every instance of special characters in every code file as you need with simply *.php as the filter and the usual find and replace routine.

Meanwhile, .htaccess is for configuring the server handle instead of the web application that you’re working on.

If you have got FTP working and somehow the main page is showing correctly, that means that at some point you have achieved UTF-8 throughout the connection, which is geat. If you managed to do that again, simply re-upload all files and they’ll all be in UTF-8 encoding, and your problem will be solved.

Cheers!

7 Likes

I have tried to delete and reload a few files, but they still have the original content type (not utf8) - and there are hunderts of these files.

You can have a look when here:

hilbert.infinityfreeapp.com

I have manually changed the three main pages to UTF-8.
But to do that with all files will take too long time.
What would you suggest?
Kind regards

Hi Hilbert,

When inspecting your website, we noticed that some pages do have issues showing characters, however, we also noticed that even though the content type is set to UTF-8, your page has a meta tag that overrides the encoding to something else:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

One example of this happens here:
http://hilbert.infinityfreeapp.com/Slaegt%20HTML/names.htm

You might want to remove these lines from all your files to make them UTF-8. Unfortunately, since this is from within each file, there is no shortcut to this. The fastest way to replace the meta tag with nothing is to do it via VSCode/Notepad++, both offering the replace-in-files feature. You should also check if these files all have the same meta encoding just in case.

As I also noticed that you used some sort of page index generator, you might be able to change this from the application settings (if available) and generate all the pages again.
<meta name="Generator" content="GEDHTanc Version 2.46.1">
https://jvo.dk/jvo/gedcom/gedhtanc.htm

Cheers!

6 Likes

Please note that setting charsets with meta tags is not supported with HTML5. With HTML5, you must always use UTF-8 encoding. Your site is using an outdated HTML version so it might be fine, but relying on outdated functionality to run your website is not a good long term solution.

So the proper solution is to convert the encoding of your files. As for how to do that, I don’t know. Maybe there are tools that can automatically convert all the files in a directory. Or if you are using certain software to edit your website, maybe it has an option to save all files as UTF-8.

6 Likes

Hi chiucs123
I have changed the first 16 htm files (anc00001.htm - anc00016) and just by changing xE6 (white in black box) to æ these pages shows correctly.
All other text can be changed in one go by Notepad++, but unfortunately this (xE6) can not be handled by Notepad++. VSCode can, but only one file at a time.
Or have I overlooked something.
Thank you very much for trying to help.
Kind regards

Hi Hilbert,

In VSCode file listing, select the folder that contains the HTML files or anywhere blank to select the root, right click and choose “Find in Files”, then you’ll be brought to a search result list. From the search box, hit CTRL + H, and a replace box will appear, input the character you need and press CTRL + Shift + Enter and you’ll be able to replace accross files.

Cheers!

2 Likes

Thanks again, but my version of VSCode (x32) only works when I choose a single file from the list (folder)

Hi Hilbert,

I guess this is not the issue with x32, you can try open folder instead to see if you can at least see a file tree first, then right click on the folder to see if there’s an option to find in folder.

Cheers!

1 Like

I think that was what I did. I got the list (tree?) and marked all files as shown here, and the result was as shown in my former picture (no results found).

Hi Hilbert,

You should be able to do something like this on right-click:
image

Cheers!

1 Like

Cannot find this. Where to right click. Should all files be marked? (as in previous picture).


Sorry to bother you again - communication can be difficult.

1 Like

Hi chiucs123
I have tried so much - and found a simple way to get one fil at a time working in Notepad++:
From the coding menu to choose charset Windows-1252, then convert to UTF-8 and save. But even that is too hard for my hand/fingers with hundreds of files - so I tried to record a makro for that. But the makro did not work - sh…
I am close to giving up after so many hours.
Have a nice weekend. Hilbert