Peace and Protection forum
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: PnP Themes break utf8
asura
Newbie
*




Posts: 2
Registered: 20-8-2009
Member Is Offline


[*] posted on 20-8-2009 at 16:19
PnP Themes break utf8


This is probably not going to get looked at but I thoghut I'd report it anyway.

The PnP theme font settings don't understand the mirc 6.35 'display/display and encode settings' for utf-8 in the font dialog.

and somehow it is ovveriding manually set channel font settings so ''う三つのメディア' (no idea what it means, just copied from somewhere) comes out as 'う三つのメディア' unless you disable 'use PnP text themeing'
View user's profile View All Posts By User
asura
Newbie
*




Posts: 2
Registered: 20-8-2009
Member Is Offline


[*] posted on 23-8-2009 at 11:20


Also with 'use PnP text themeing' utf-8 urls show ok

but if you double click them it's not sending utf-8 to the browser, but garbage again.

eg. i see http://➞.ws/armaPickup fine, but can only copy and paste to visit the arma pickup website, double clicking goes to xn--2ca62aa.ws instead :(

[Edited on 27-8-2009 by asura]
View user's profile View All Posts By User
FiXato
Junior Member
**




Posts: 3
Registered: 3-9-2009
Member Is Offline


[*] posted on 3-9-2009 at 15:50
Fixed it in a theme


It seems to be related to some themes; in particular the 'PnP "test" theme w/normal events' theme at least.
From what I can see, it goes wonky because of the and characters in the theme, which you can see/edit in the Theme's "Text Theme" screen.

I don't use PnP myself, but a friend of mine who does always complained about my weird characters when I screamed U! in the channel.

At first I thought it was related to mIRC, but strangely enough it never went wrong in our PM windows. So I installed PnP myself on a virtual winxp, and tried to debug it.. which eventually led to this solution.

I've managed to rewrite the text theme for it to use $utfencode() and $utfencode(), which seems to work!

I'll embed the text here within a couple of minutes, and will also put them up as UTF-8 and Latin-1 encoded files.
My friend had to use the Latin-1 encoded file, probably since mIRC's interface itself seems to be Latin-1.

[Edited on 3-9-2009 by FiXato]




==
Freelance Rubyist / Webdeveloper
FiXato.co.uk and my open source code on github
View user's profile View All Posts By User
FiXato
Junior Member
**




Posts: 3
Registered: 3-9-2009
Member Is Offline


[*] posted on 3-9-2009 at 17:17


The code:
Code:
ActionChan !Script %:echo $utfencode() %::nick %::text ActionChanOp <lt>*<nick>:<target>*<gt> <text> ActionChanSelf !Script %:echo $utfencode() %::me %::text ActionQuery !Script %:echo $utfencode() %::nick %::text ActionQuerySelf !Script %:echo $utfencode() %::me %::text Notice !Script %:echo $+($utfencode(),%::nick,$utfencode()) %::text NoticeChan !Script %:echo $iif(%::target == %::chan,$+($utfencode(),%::nick,::,%::target,$utfencode()),$+(<-,%::nick,:,%::target,->)) %::text %:comments NoticeSelf !Script %:echo -> $+($utfencode(),%::nick,$utfencode()) %::text NoticeSelfChan !Script %:echo -> $iif(%::target == %::chan,$+($utfencode(),%::target,$utfencode()),$+(<-,%::target,->)) %::text %:comments TextChan !Script %:echo $+($utfencode(), ,%::cnick,%::cmode,%::nick,,$utfencode()) %::text TextChanOp <lt>*<nick>:<target>*<gt> <text> TextChanSelf !Script %:echo $iif($_optn(0,23),$+($utfencode(),,%::cnick,%::cmode,%::me,,$utfencode()),$utfencode()) %::text %:comments TextMsg !Script %:echo $iif($event == ACTION,$+($utfencode(),$utfencode(),%::nick,$utfencode(),$utfencode()),$+($utfencode(),*,%::nick,*,$utfencode())) %::text %:comments TextMsgSelf !Script %:echo -> $+($utfencode(),*,%::nick,*,$utfencode()) %::text TextQuery !Script %:echo $+($utfencode(),%::nick,$utfencode()) %::text TextQuerySelf !Script %:echo $iif($_optn(0,23),$+($utfencode(),%::me,$utfencode()),$utfencode()) %::text %:comments TextSelfChanOp -> <*<target>*> <text>



And the download links:
Fix in Latin-1 format and UTF-8 format
Edit: I've saved the theme as well, so here is a fixed MTS theme file

Right-click, save file as, and open in your favourite (plain) text-editor. (Or you could try opening them directly in your browser, though I don't guarantee that the encoding will be correct then..)

Now select everything in that file and copy it (CTRL-C).
Open your PnP and type: /theme
Go to the Text theme section and make sure that "Edit theme lines" is selected.
Select everything that is in the big input box and paste the contents of the fix-file over it (CTRL-V).
Press the Ok button and everything should work now.

License: Everyone is free to copy/distribute/modify these fixes as long as they attribute :)

[Edited on 3-9-2009 by FiXato]

[Edited on 3-9-2009 by FiXato]




==
Freelance Rubyist / Webdeveloper
FiXato.co.uk and my open source code on github
View user's profile View All Posts By User
FiXato
Junior Member
**




Posts: 3
Registered: 3-9-2009
Member Is Offline


[*] posted on 3-9-2009 at 22:15


Unfortunately it looks like this introduces some new problems..
If you have UTF8 support set to 'display and encode', all text that your client receives without utf-8 characters will be interpreted by your mIRC as Latin-1; thus it will have problems properly showing the and characters, probably because it is trying to combine Latin-1 with UTF-8 text by double encoding everything.

If you have UTF8 support set to display only, the and will look good with non-UTF8 text, but weird as well with UTF-8 text, because it also tries to double encode it..

My suggestion would be to rip out all the special characters such as and and find some normal ascii characters for it so you don't have to use $utfencode()
That way no text will be double encoded.

I'll see if later this week I can create a theme file that will have some proper replacement characters..




==
Freelance Rubyist / Webdeveloper
FiXato.co.uk and my open source code on github
View user's profile View All Posts By User
kap
PnP Developer
**




Posts: 31
Registered: 6-8-2015
Member Is Offline


[*] posted on 10-8-2016 at 12:20


Ok I've found the following website really helpful:

http://bindibox.net/www.mircscripts.org/comments10a4.html?ci...

In it masamunecyrus describes a simple fix for installing old themes with unicode mIRC.

Quote:

We need to display this text file in ANSI format, convert it to unicode, and then save it as a unicode file. Here's how I did that. Open up a command prompt in this folder (shift-right click in Explorer, Open command window here...), and then do like the following:

chcp 437 & clip < stealth.mrc

What this does is change the command prompt to codepage 437 (which will display these old theme files with the correct font), and then copy the entire stealth.mrc file into the clipboard.

Then, open notepad and CTRL+V paste. You should see that you've pasted the stealth.mrc with all of the proper font. Now go to File>Save as... and make sure, at the bottom where it says, Encoding:, to change it from ANSI to Unicode. Save over the top of the old stealth.mrc,



I tried this with the PnP test theme and it didn't work. So I found the codepage that does work to be 1252 (as found here: https://msdn.microsoft.com/nl-nl/library/windows/desktop/dd317756(v=vs.85).aspx)

Simply type the following:

Code:
chcp 1252 & clip < test.mrc


open notepad and paste and then save it over the top.

I'll talk to craze and solbu about changing it on GitHub...

edit: On first glance, seems to be ok on GitHub...

edit2: on second glance, the raw was still showing strange characters as found here:

https://raw.githubusercontent.com/solbu/Peace-and-Protection...

I've changed all mts files from cp 1252 to UTF-8 and put them in the master/dev branch on GH.

https://github.com/solbu/Peace-and-Protection/commit/b3cc103...


cheers

kap



[Edited on 10-8-2016 at 12:27 by kap]

[Edited on 11-8-2016 at 04:52 by kap]
View user's profile View All Posts By User
kap
PnP Developer
**




Posts: 31
Registered: 6-8-2015
Member Is Offline


[*] posted on 12-8-2016 at 21:21


All script files in GitHub repo (including theme files) are now UTF-8 encoded...This shouldn't be an issue any longer!
View user's profile View All Posts By User

  Go To Top

Powered by XMB
XMB Forum Software © 2001-2012 The XMB Group