- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am running a program to output the degree sign. The degree sign on the English and Japanese set up is 176 on the character map. The relavent parts of the code are
-----------------------------------------------------
INTEGER*2 IN
INTEGER J
.
.
IN=176
J=MBCONVERTUNICODETOMB(IN,C2)
.
WRITE(6,*)C2(1:J)
---------------------------------------------------
ON running the program J has a value of 2 (bytes) and when opened in textpad the entries are81 and 8B and on subsequent output gives ?? on a drawing.
How can i get the degree suymbol ( and other chatacters in the character map range 127-255) to be correctly output on a Japanese window system
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![Smiley with tongue out [:-P]](/isn/Community/en-US/emoticons/emotion-4.gif)
Given the headaches of MBCS, I'd say your best bet would be to use Unicode all around (although it would probably also require extensive use of APIs such as WriteConsoleOutputCharacterW rather than plain WRITEs).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may need to check which font you are using for the output and that it supports the character set you require. I notice you mention "drawing" Do you mean hard copy (paper) or a drawing in a window? Are you developing ON a Japanese system or FOR a Japanese system?
For example. We aredeveloping on English Windows XP for non-English users. The following is some (cut down) code used to take a simple ascii text string and convert it to Unicode.
!-----------------------------------------------------------------------
subroutine schara(string,iclen)
implicit none
integer :: ICLEN
character(*) :: STRING
integer(2), DIMENSION (256) :: utext
INTERFACE TO SUBROUTINE mbcs2unicode [C,ALIAS:'_mbcs2unicode'] (d,e,f)
integer*4 :: d
integer*4 :: e
integer*4 :: f
END
t_len = iclen
call mbcs2unicode(loc(string), loc(t_len), loc(utext))
end subroutine schara
and the c file : mbcs2unicode.c
#include
#include
#include
void mbcs2unicode (char *lpszA, int *iLen, short *utext)
{
int i;
TCHAR s_lcid[6];
WCHAR lpszW[256];
LCID LCid,CPage;
// Get Current User Locale ID and translate into a Code Page
LCid = GetUserDefaultLCID();
// Default code page = English
CPage = 1252;
i = GetLocaleInfo(LCid,LOCALE_IDEFAULTANSICODEPAGE, s_lcid, 6);
// Check we got a code page
if (i != 0) {
CPage = _ttoi(s_lcid);
if (CPage == 0) {CPage = 1252;}
}
*iLen = MultiByteToWideChar(CPage, 0, lpszA, *iLen, lpszW, 256);
for (i=0; i<*iLen; i++) {
utext = lpszW;
}
}
Hope this helps
Les

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page