Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    490
    Thanks
    101
    Thanked 17 Times in 17 Posts

    Umlaut displays in main web page, but not in its popup window

    Hello,

    I'm not able to display the letter "o" with an umlaut above it, for example "ö", when using it in a popup window. The umlaut displays in the regular document, which the suffix is .php. All the rest of the text displays perfectly in the popup window. I'm using the following code to call my .txt document:
    Code:
    <!--#include virtual="page.txt"-->
    The charset meta tag that I'm using at the top of my main page:
    Code:
    <meta charset="UTF-8">
    I'm using the current version of Opera and Chrome. Neither displays the umlaut in the popup window.

    Any help would be greatly appreciated.

    Thank you,
    Kevin
    Last edited by Kevin_M_Schafer; Dec 31st, 2018 at 01:15 PM. Reason: punctuation
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well. | Maintaining the aspect ratio of an image is important.

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    7,910
    Thanks
    36
    Thanked 1,057 Times in 1,053 Posts
    Have you tried the using these numerics for the umlauts a, e, I, o, u?
    &#228
    &#235
    &#239
    &#246
    &#252
    With a ; after the number, I removed them so the number shows up instead of ö
    Last edited by sunfighter; Dec 31st, 2018 at 08:33 PM.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. Users who have thanked sunfighter for this post:

    Kevin_M_Schafer (Jan 1st, 2019)

  4. #3
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    11,215
    Thanks
    6
    Thanked 1,347 Times in 1,316 Posts
    What shows up instead of the umlauts? Strange characters or diamond shapes? Make sure you also saved the HTML file(s) as UTF-8 in your code editor. Usually you can set that in the preferences somewhere.

    Also, instead of the numbered HTML entities there are also named entities for umlauts:

    Umlaut Entity (uppercase) Entity (lowercase)
    ä &Auml; &auml;
    ö &Ouml; &ouml;
    ü &Uuml; &uuml;

  5. Users who have thanked VIPStephan for this post:

    Kevin_M_Schafer (Jan 1st, 2019)

  6. #4
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    7,910
    Thanks
    36
    Thanked 1,057 Times in 1,053 Posts
    Stephan, What did you use to be able to put the whole code in your post?
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  7. #5
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    490
    Thanks
    101
    Thanked 17 Times in 17 Posts
    sunfighter and VIPStephan,

    Thank you for your posts. The methods both of you have shown work perfectly. I was receiving empty little squares in Opera and little squares with question marks in Chrome.

    I really appreciate your time. Thanks again.

    Kevin
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well. | Maintaining the aspect ratio of an image is important.

  8. #6
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    3,426
    Thanks
    3
    Thanked 597 Times in 583 Posts
    Hi there sunfighter,

    Stephan used this BB code:-

    Code:
    [TABLE]
     [TR]
     [TH]Umlaut[/TH]
     [TH]Entity (uppercase)[/TH]
     [TH]Entity (lowercase)[/TH]
     [/TR]
     [TR]
     [TD]ä[/TD]
     [TD]&Auml;[/TD]
     [TD]&auml;[/TD]
     [/TR]
     [TR]
     [TD]ö[/TD]
     [TD]&Ouml;[/TD]
     [TD]&ouml;[/TD]
     [/TR]
     [TR]
     [TD]ü[/TD]
     [TD]&Uuml;[/TD]
     [TD]&uuml;[/TD]
     [/TR]
     [/TABLE]

    coothead
    ~ the original bald headed old fart ~

  9. #7
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    11,215
    Thanks
    6
    Thanked 1,347 Times in 1,316 Posts
    Quote Originally Posted by sunfighter View Post
    Stephan, What did you use to be able to put the whole code in your post?
    Nothing special. I think the forum only reacts to numeric entities; I’ve experienced that with the PHP code BB tags where it automatically translated special characters to numeric entities in some cases (screwing up the intended output). I’ll see whether there is a setting for that in the admin area.

  10. #8
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    11,215
    Thanks
    6
    Thanked 1,347 Times in 1,316 Posts
    Testing a workaround:
    &#235;

    Ah, there you go. What I did above was to wrap the semicolon in [noparse][/noparse] BB code, like so:
    Code:
    &#235[noparse];[/noparse]
    Last edited by VIPStephan; Jan 1st, 2019 at 01:36 AM.

  11. #9
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,273
    Thanks
    4
    Thanked 476 Times in 464 Posts
    This might be a silly question on my part, but could you define "popup window"? Are you using prompt? alert? window.open? faking it with a DIV/CSS/JS?

    It does make a difference. Prompt/alert have piss poor non-ASCII7 support, window.open requires you declare the full document again and can if force-fed content screw up the encoding... and using a position:fixed DIV so you have full styling control and it's all part of the same page wouldn't have any of these problems.

    Also what does FF/IE/Edge/Safari do? If you're developing for the web you should be testing at least three different browser engines -- not just the one. (since chrome, Opera, Vivaldi, etc, are all running Blink)
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com

  12. Users who have thanked deathshadow for this post:

    Kevin_M_Schafer (Jan 1st, 2019)

  13. #10
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    490
    Thanks
    101
    Thanked 17 Times in 17 Posts
    Quote Originally Posted by deathshadow View Post
    This might be a silly question on my part, but could you define "popup window"? Are you using prompt? alert? window.open? faking it with a DIV/CSS/JS?

    It does make a difference. Prompt/alert have piss poor non-ASCII7 support, window.open requires you declare the full document again and can if force-fed content screw up the encoding... and using a position:fixed DIV so you have full styling control and it's all part of the same page wouldn't have any of these problems.

    Also what does FF/IE/Edge/Safari do? If you're developing for the web you should be testing at least three different browser engines -- not just the one. (since chrome, Opera, Vivaldi, etc, are all running Blink)
    Hi deathshadow,

    Thanks for the reply.

    I'm using a DIV overlay with a fixed position for a popup. I wanted something dynamic so that the viewer could find a text abbreviation for the content they are reading. They may use the popup several times before leaving the main web page.

    Here's what I'm using to call for a popup window:
    Code:
    <a href="#abrev-overlay" class="variablebox-e">Abbreviations Defined</a>
    Here's my fixed DIV:
    Code:
    <div id="abrev-overlay" class="overlay">
       <div class="popup-window">
          <h2>Abbreviations</h2>
             <a class="close" href="#"><i class="fas fa-window-close"></i></a>
          <div class="include">
             <!--#include virtual="page.txt" -->
          </div>
       </div>
    </div>
    I'm now also using FF as you suggested. I found out that IE11 won't go on Win7 without some help, and that Safari isn't exactly current for PCs.
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well. | Maintaining the aspect ratio of an image is important.

  14. #11
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,273
    Thanks
    4
    Thanked 476 Times in 464 Posts
    ASP... figures. Are you 100% sure it's not sending the http headers as windows-1252 or ISO-8859-1? Remember, your HTTP headers trump anything set in your HTML. You can set that charset meta until blue in the face, but if the server is sending something else in the http header, the browser is going to do that instead. Usually when these types of problems arise, that's the culprit.

    Especially since M$ still seems to prefer 8859-1 as the default and often slides over to 1252 because it can. One of the MANY reasons I would never use any M$ technology for web hosting. They're so inept at it even the simplest things turn into a nightmare.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com

  15. #12
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    490
    Thanks
    101
    Thanked 17 Times in 17 Posts
    deathshadow,

    I neglected to mention that I'm using XAMPP at this time, the current version 7.2.12 on M$W7. I have a full hosting account with BH, but I'm currently building my project locally. Maybe this is silly; maybe I should use the web for building. I did need to go in and tweak the config file in XAMPP to allow .php for a file extension so I could use the popup method that I chose.

    Is my fixed DIV the way to go, to display a dynamic box of text? The content in the popup would be a couple of screens-worth high if it weren't encased in a small box with a scrollbar. When the user simply clicks on the X to close the popup window, they can go on to keep reading the main page without a refresh and losing their place.

    The code that sunfighter and VIPStephan proposed for generating umlauts in the popup does work great. For some reason ever since I used the code shortcut for the umlaut, &ouml;, I can enter characters with umlauts in my .txt document and they are read by the browser. I even cleared my cache and still umlauts are showing in the popup window without coding a shortcut. This is great, and it's almost like Opera learned from it. FF shows them perfectly.
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well. | Maintaining the aspect ratio of an image is important.

  16. #13
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,273
    Thanks
    4
    Thanked 476 Times in 464 Posts
    Using the named entities bypasses the utf-8 encoding -- as (in theory) all the HTML named entities should work regardless of the character encoding. It's why I preferred to use them for "skin/template" related content on CMS/forum skins, since we used to never know what encoding the end user will want. Now that UTF-8 is mostly a reality I use them less and less.

    Because you're bypassing the problem it's likely that other characters -- possibly everything UTF-8 outside the bottom 7 bits of ASCII -- still doesn't work... though if that were so font-awesome shouldn't work either.

    Are you familiar with document inspectors? If you use the one in FF under the "networking" tab and do a refresh, on the bottom right you can look at what headers are being sent. The one to look for is "Content-Type" which [i]should[/b] be set to "text/plain; charset=UTF-8" but quite often Apache will do iso-8859-1 instead.

    Side note, I thought this was ASP, my bad you're using SHTML... there's a reason that's not real common anymore.

    Since it's Apache, you could try setting it in a .htaccess file.

    Code:
    AddDefaultCharset utf-8 .css .html .js .shtml
    That might correct the behavior.

    Part of why many will tell you to put on the big boy pants and use PHP instead of SHTML includes. Since then you could just start the document with:

    Code:
    <?php header('Content-Type: text/plain; charset=UTF-8'); ?>
    ... and replace your include with:
    Code:
    <?php include('page.txt'); ?>
    Which lets you set the encoding on the fly for the document reliably regardless of what server (apache, IIS, ngnix, etc) is in use.

    It is something I would at least try to address since whilst it's hitting you for just one character in the "here and now" it could keep biting you long term.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com

  17. Users who have thanked deathshadow for this post:

    Kevin_M_Schafer (Jan 3rd, 2019)

  18. #14
    Regular Coder Kevin_M_Schafer's Avatar
    Join Date
    Apr 2011
    Location
    Fairfax, Minnesota, U.S.A.
    Posts
    490
    Thanks
    101
    Thanked 17 Times in 17 Posts
    Thanks, deathshadow.

    I inserted your provided PHP include statement for my "page.txt" in place of the traditional SHTML include line. It works perfectly!

    However, when I placed the PHP header line at the top of my index, when the page loads, the entire page turns into a notepad-looking document, showing nothing but code -- no styling and unusable.

    I should be good just using the PHP include line. Everything looks exactly the same as when I was using the SHTML line of code. At the top of my index I have <meta charset="UTF-8">.
    Last edited by Kevin_M_Schafer; Jan 2nd, 2019 at 03:44 AM. Reason: grammar
    My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well. | Maintaining the aspect ratio of an image is important.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •