- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to use the extended ASCII Character Codes (128-255) within CVF 6.0 and within program output? I am interested in using some of the greek symbols. Thanks for any advice.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Program output to where? Console? Dialog? Window?
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use these extended characters in formatted text output written to files, as well as in the comments within the source code itself within the text editor of CVF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Within your source code, you can type extended characters if the current script of the source font contains them. You can set the font using Tools/Options/Format/Source Windows/Font. You have to choose font script for one code page (as source files are not UNICODE). For example, on my computer I see "CE", "Cyr", and "Greek" versions of Courier New. This setting only affects characters 128-255, as the first 128 are always the same (ASCII) for every code page.
As for the output, it's trickier. Have in mind that whatever you write into a file is just a sequence of bytes... and bytes can have only values 0-255. For example, big Greek letter Sigma has unicode value of 0x3A3, but in Greek code page it is mapped to position 211 (0xD3). So, the question is not "whether I can display Sigma in a text file?", but "what should I do to have 211 interpreted as Sigma?". So, if you open the file containing that 211 in editor with e.g. Courier New Greek font, you'll see Sigma; if it's Courier New Western, you'll see E grave (); on Central European, it's C Caron etc.
See also this little program which uses SetConsoleOutputCP API to change console code page, then displays characters 128-255 in four different scripts. It works on Windows 2000, as it's Unicode under the hub (I doubt it will work on 9x/ME) and only if the console output font is set to a Unicode font (Lucida Console e.g.)
Jugoslav
As for the output, it's trickier. Have in mind that whatever you write into a file is just a sequence of bytes... and bytes can have only values 0-255. For example, big Greek letter Sigma has unicode value of 0x3A3, but in Greek code page it is mapped to position 211 (0xD3). So, the question is not "whether I can display Sigma in a text file?", but "what should I do to have 211 interpreted as Sigma?". So, if you open the file containing that 211 in editor with e.g. Courier New Greek font, you'll see Sigma; if it's Courier New Western, you'll see E grave (); on Central European, it's C Caron etc.
See also this little program which uses SetConsoleOutputCP API to change console code page, then displays characters 128-255 in four different scripts. It works on Windows 2000, as it's Unicode under the hub (I doubt it will work on 9x/ME) and only if the console output font is set to a Unicode font (Lucida Console e.g.)
Program CodePage
Use Kernel32
Use User32
Implicit None
Character*129 Text
Integer*4 iCodePage, iRet
Logical*4 lRet
integer i
do i = 128,255
text(i-127:i-127) = char(i)
end do
do iCodePage = 1250, 1253
iRet = SetConsoleOutputCP(iCodePage)
If ( iRet .gt. 0 ) Then
Write (*,"(' CodePage=',i6)") iCodePage
write(*,"(A)") text
End If
End do
End Program CodePageActually, SetConsoleOutputCP affects the script of the font used to display console text. Default bitmapped font (Terminal) does not support scripts.Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help Jugoslav.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page