General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Question About Character Encoding
Posted by: foliator
Date: March 27, 2016 04:55PM

I have the macro encoding.kmm active in KM75, and can set the character encoding via the Page Display/Languages tab. By default I use the one for my current locale, e.g. ANSI or Windows 1252, but how can I change the encoding on the fly to UTF-8 for a few sites that insist on using UTF-8 without declaring it in the headers of their HTML pages?

Encoding can be easily switched in FF under View in the main menu, but the option isn't present in KM, at least not in KM75. What I had in mind was something for which I could assign a keyboard shortcut (e.g. Alt U for UTF-8).

Alternatively, if it's possible to add the appropriate command to the main menu, what would the command look like?

---
Gerry

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: guenter
Date: March 27, 2016 05:09PM

The option is in menu under View -> Encoding -> UTF8

You can relocate the command via a personalized menu entry.

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: foliator
Date: March 27, 2016 05:42PM

Quote
guenter
The option is in menu under View -> Encoding -> UTF8

You can relocate the command via a personalized menu entry.

Thanks, guenter, that was actually the first place I looked, but it's definitely nowhere in the main menu. I've also double-checked the original, unaltered menus.cfg from the KM75 package. It's not there, either.

I could insert the item into the menu myself, but I don't know exactly what the command is. Some of the functions that I've added to my context menus were simple enough, as all I had to do was call their macros, so I tried Encoding=macros(encoding), but that did nothing.

Oops! Just got this to work in my accel.cfg:
ALT U = macros(Encoding_ForceCharset(UTF-8))

I had to study the encoding.kmm file to figure it out; at first I tried it with UTF8 (unhyphenated) and crashed K-Meleon. :O grinning smiley

---
Gerry



Edited 1 time(s). Last edit at 03/27/2016 05:55PM by foliator.

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: guenter
Date: March 27, 2016 06:55PM

Quote
foliator
Quote
guenter
The option is in menu under View -> Encoding -> UTF8

You can relocate the command via a personalized menu entry.

Thanks, guenter, that was actually the first place I looked, but it's definitely nowhere in the main menu. I've also double-checked the original, unaltered menus.cfg from the KM75 package. It's not there, either.

I could insert the item into the menu myself, but I don't know exactly what the command is. Some of the functions that I've added to my context menus were simple enough, as all I had to do was call their macros, so I tried Encoding=macros(encoding), but that did nothing.

Oops! Just got this to work in my accel.cfg:
ALT U = macros(Encoding_ForceCharset(UTF-8))

I had to study the encoding.kmm file to figure it out; at first I tried it with UTF8 (unhyphenated) and crashed K-Meleon. :O grinning smiley

Accel is easier and better.

It is in the default menu - but maybe You changed it.

p.s. JS is unforgiving against typos. grinning smiley



Edited 1 time(s). Last edit at 03/27/2016 06:58PM by guenter.

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: siria
Date: March 27, 2016 07:14PM

Have double-checked in KM75, and it's definitely still there (where it always has been). In VIEW-menu, right below "Zoom". If not, it must have been changed somehow via user settings or other macros, perhaps accidentally.

This is one of the macros which create their menu entries in the kmm directly, not in menus.cfg

And this is a rather complicated menu, congratulations that you figured out the exact command smiling smiley
Now that you have it, you can also copy the utf-8 to any other menu place for quicker access.

But I'd really make UTF-8 the default encoding in todays web. Perhaps just test it a while?

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: foliator
Date: March 27, 2016 08:21PM

Yes, I've already added the command to one of the toolbars with a custom-made icon (just a blue U). I've also added it to the compact menu -- not under View, but in the top level of the compact menu right below Help. I have about:config, about:preferences and KM's own settings dialog down there, as well, and an extra copy of the Restart command. With all this fiddling around, Restart comes in mighty handy! winking smiley

As for the main menu, to free up some vertical space I keep it hidden; everything's in my compact menu for the sake of convenience. Not only that, but I have Compact Menu as an item in the context menu for document popups, and can also bring it up with Alt M.

When I looked at the original menu.cfg that came with the downloaded KM75 package, Encoding wasn't in there, but that's probably because the encoding macro has to be enabled to create that menu item.

Whew! Doesn't look too much like the original K-Meleon 75 anymore; maybe I should combine it with my username and call it K-Meleonator. grinning smiley

---
Gerry

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: foliator
Date: March 27, 2016 08:29PM

Quote
guenter

p.s. JS is unforgiving against typos. grinning smiley

Yes, but not as bad as Firefox's userChrome.css. In the process of learning the various CSS codes for tweaking FF's UI I also learned how to totally screw it up. grinning smiley

---
Gerry

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: siria
Date: March 27, 2016 09:51PM

Hehe, cool! Welcome in the club of heavy tweakers grinning smiley

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: foliator
Date: March 27, 2016 11:21PM

Quote
siria
Hehe, cool! Welcome in the club of heavy tweakers grinning smiley

The Tweak of the Week Club! grinning smiley

By the way, I tried setting UTF-8 as the default, but it still couldn't deal with pages in which the encoding isn't specified in the header, so I set the default back to what I had before.

Those web designers out there should really be more compliant with basic HTML standards. In some cases even German umlauts, which are supported by the default encoding in Windows, were not rendered by those sites. Example: mit freundlichen Grüßen comes out like this: mit freundlichen Grüßen.

Hmmm ... mit freundlichen irgendetwas. smiling smiley

---
Gerry

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: siria
Date: March 28, 2016 06:54AM

Can you post a few example links?
Because can't help wondering if there's more involved, since I come across such pages at worst 1 out of 1000 (with KM1.6), and am viewing lots of umlaut pages.
Perhaps it's that "Auto Detect" setting in the encoding menu? Have it usually set to "Universal", probably default.
If you still don't see the Encoding menu, suggestion to add it as right-click to your button ( |En&coding). PS: perhaps your whole PageDisplay menu chapter is hidden? In menus.cfg it contains only Zoom In/Out Text, but those 2 entries are removed again by zoom.kmm, which replaces them with the zoom-popup-menu. But that doesn't remove the parent chapter "PageDisplay", it should still work for other macros to share, like Encoding.

But who knows, perhaps even UA has some influence?
Or even some bug in newer KM? Am not quite trusting this thing with "UTF-8" (OK, old standard) vs. "utf-8" (new standard, breaks forcecharset)...
But cannot test online myself with KM7X, only 1.6, and for the 7X-tests on Vista only use the local readme-pages.



Edited 1 time(s). Last edit at 03/28/2016 10:17AM by siria.

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: foliator
Date: March 28, 2016 05:56PM

Actually, siria, UTF-8 is the only alternate encoding I need, and switching to it is quick and easy thanks to those KM tweaks; even quicker, in fact, than in Firefox.

The rest of the encoding menu is of no use to me, since the other character sets are usually only used on websites written in languages I can't even understand, such as the various Asian or Middle East languages. Cyrillic is rendered properly using my default encoding, although I can't read Russian, either. I have to rely on Google Translate for those sites. The only languages I can read fluently are English (my native language) and German, which I studied in university as my major subject many years ago.

I don't know what effect the UA has on character encoding, but I always fake a very recent UA. In this case, KM75 is identifying itself as Firefox 43, which matches the version of FF I also have on my computer.

You'd never believe how many extensions I had to add to FF -- 18 of them -- to get the same functionality of KM and its macros, but FF takes much longer to start up than KM and uses four times the RAM. I only keep it in case I run into some sites where KM isn't fully supported, e.g. one of the scripts in Google's Webmaster Tools doesn't work in KM, so I have to use FF for that.

---
Gerry

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: siria
Date: March 28, 2016 08:23PM

Yeah I see your point, you're happy how it works now. That's what matters most!

-----
Anyway, if some day other people with encoding probs may stumble across this thread later, they could experiment with those prefs etc.:

intl.charset.default = UTF-8 (or ISO-8859-15 for old german etc.?)
intl.charset.detector = universal_charset_detector (or empty?)

None of those prefs is affected by the default encoding set in user preferences. In general charset handling seems to use several prefs and is above my head, so just trial-and-error ;-)
Also dimly remember that some 7X KM-version had forgotten a cyrillic default, KOI8-R, that was meanwhile fixed in the updated macro "encoding.kmm" which can simply be copied over if needed.
Apart from that, the engine in KM76beta seems to handle encoding somehow differently, had probs with another macro (if sessions.json or prefs.js are opened as browser page, KM ignores the default charset and always uses ANSI, messing titles of stored sessions. Perhaps assuming from the ending "this is code" or such, no idea)

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: foliator
Date: March 28, 2016 10:00PM

You open prefs.js and sessions.json as browser pages? I guess they can be viewed that way, but normally I'd open them in my default text editor, AkelPad, which is in my Windows SendTo folder. I also send mimetypes.rdf to AkelPad. The editor identifies all of them as Windows 1252 (ANSI) files, but mimetypes.rdf uses Unix line endings. I've also configured the registry's "Edit" option for .js files to use AkelPad instead of Notepad. Of course, I wouldn't edit any of those files while the browser is running.

It sounds like KM doesn't use your default encoding because those files are not HTML pages. Maybe if they're open in the browser you could ask to view the source, assuming you've assigned an editor for that; even Notepad would be sufficient.

---
Gerry

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: siria
Date: March 28, 2016 10:42PM

Only KM76 has that prob currently. Notepad++ and older KM versions up to 75.1 show the content as UTF-8 (in KM using default charset). But KM76 keeps ignoring that and the error console complains that the files need a BOM-mark for the encoding or such.
(just hope I remember that correctly, had needed this as workaround for a sessionlister macro but RL forced me to interrupt some months ago and a lot forgotten already, grrr)

Options: ReplyQuote
Re: Question About Character Encoding
Posted by: rodocop
Date: March 29, 2016 12:07AM

KM shows some pages (like txt-files) in 'quirks mode' by engine's default.

I think we cannot change it.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.