#1 2009-02-16 19:13

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Unicode in PascalScript editor

Hi, Dennis!
I'm not sure if it's up to you, or it's the question of PascalScript engine, but you can't use eg. Russian letters, while editing PascalScript.
You can see them as you write, but when you press Enter, they become '?????????'.
So you can't use any string constant with unicode letters, nor assign such string to WideString variable.

I came up with that problem, when solving the question of a-zz serialization. I tried to serialize files according to Russian alphabet, but it failed.

Thanks in advance for reply.
Konrad


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#2 2009-02-18 14:38

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Unicode in PascalScript editor

PascalScript does not support Unicode in code, and I don't think it will in any near future.

Anyway, I am able to use Russian letters in PascalScript, and you can too. You need to go to Control Panel -> Regional and Language Options -> Advanced tab -> set Russian as a default language for non-Unicode programs. That will automatically activate appropriate Russian code pages and you'll be able to use Russian letters in PascalScript, using ANSI instead of Unicode.

renamerrussiancodepagelk7.gif

Offline

#3 2009-02-18 20:52

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Unicode in PascalScript editor

Thanks,
I hoped AppLocale will do same trick without rebooting, but unfortunately it failed.
I'll certainly use your idea when I get to that problem ever again.  It need two reboots (one to get Russian codepage, and one to get back to my own) but it works smile
Cheers,
Konrad


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#4 2009-02-19 00:06

prologician
Member
Registered: 2009-01-30
Posts: 84

Re: Unicode in PascalScript editor

Two obvious thoughts:

One, you could always write the file (outside of Renamer) in UTF-8, and assign the string as a constant. Then, when you need to actually use the value in a script, apply UTF8Decode() (I don't recall if that's right), to finish the job.

Barring this, you might be able to apply my Iconv stuff to get something accomplished as well, without the codepage changing. (I do intend on getting back to that~! There's a few things I wanna add in.)

Offline

#5 2009-02-20 13:23

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Unicode in PascalScript editor

That is true. PascalScript doesn't support Unicode ONLY in the code (in the editor window), but loading Unicode / UTF-8 text from external files into variables will work just fine.

Offline

#6 2009-02-20 15:50

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Unicode in PascalScript editor

Thanks guys. The second option (with loading UTF-8 text from external file) is really temptating.


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#7 2009-02-20 17:13

prologician
Member
Registered: 2009-01-30
Posts: 84

Re: Unicode in PascalScript editor

A word of caution on this point, which I did try out when I replied to this thread the first time, though I made no note of.

When you're putting together your UTF-8 text file, be sure that whatever editor you're using does NOT put in the byte-order mark at the start of the file. If you include Unicode text in the script file, it confuses the PascalScript interpreter with the excess characters (or, in the case of loading from external files, will make the logic more complicated.... I think, this I did not try, but in all likelihood).

I know for sure that Notepad (which comes with Windows XP) always sticks in the byte-order mark. You can delete it by using a hex editor, or I know that Notepad++ has an option to remove such from the file. smile

Offline

Board footer

Powered by FluxBB