Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

mbconvertunicodetomb and mbconvertmbtounicode routines

steve_konarski
Beginner
285 Views

I have the program


program nlstest
use dfnls
implicit none
integer*2 uni1(1),uni2(1)
character*30 lang,country
character*2 c2
integer*4 codep,j1,j2 ,n



call nlsgetlocale(lang,country,codep)
write(*,*)'locale ',lang(1:8),country(1:8),codep

do n=176,190
uni1(1)= n
call nlsetlocale(lang,country,codep)
j1=mbconvertunicodetomb(uni1,c2)
j2=mbconvertmbtounicode(c2,uni2)

write(*,*)uni1(1),j1,j2,' ',c2(1:j1),uni2(1),' ',char(n)

enddo

stop
end

on an english set up 'machine' i get

localeEnglish United K 1252
176 1 1 176
177 1 1 177
178 1 1 178
179 1 1 179
180 1 1 180
181 1 1 181
182 1 1 182
183 1 1 183
184 1 1 184
185 1 1 185
186 1 1 186
187 1 1 187
188 1 1 188
189 1 1 189
190 1 1 190

and on the japanese set up machine i get

locale English United S 932
176 2 1 176
177 2 1 } 177
178 1 1 2 50
179 1 1 3 51
180 2 1 L 180
181 2 1 956
182 2 1 182
183 2 1 E 12539
184 2 1 C -244
185 1 1 1 49
186 1 1 o 111
187 2 1 8811
188 1 1 ? 63
189 1 1 ? 63
190 1  ; 1 ? 63

On the Japanese machine, why are some of the characters mulibyte and why do you not get the same unicode integer valus out of mbconvertmbtounicode as the input one to mbconvertunicodetomb , On the Japanese machine the output for the "degree" sign is two variables is "81 8B" when opened with text pad and not B0 = 176

0 Kudos
0 Replies
Reply