Announcement

Collapse
No announcement yet.

Printing accentuated characters

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing accentuated characters

    I'm using the PRINT # statement for writing data to a sequencial
    file starting with OPEN "filename" FOR OUTPUT AS #1.

    When viewing this file under DOS or printing the created file it
    appears that the accentuated characters (é, à, ö, etc), which
    have an ASCII value of greater than 127, have been changed.

    Similar application under PB for DOS did not pose any problem.

    Did any of you experienced the same problem?

    Thanks for your attention.

    José
    mailto:[email protected][email protected]</A>


    ------------------

  • #2
    The DOS character set is OEM ASCII. The Windows character set is ANSI.
    They are not the same for characters over CHR$(127). You can convert a
    string from one to the other using the Windows API calls, CharToOem and
    OemToChar.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3
      Tom,

      Many thanks for the information

      In WIN32API.INC I found the following function declaration:

      Code:
      DECLARE FUNCTION CharToOem LIB "USER32.DLL" ALIAS "CharToOemA" (lpszSrc AS ASCIIZ, lpszDst AS ASCIIZ) AS LONG
      It is not clear to me how to use this function.
      As I understand it required two arguments and returns a long integer value.
      Do you have more information on how to apply this function e.g. in case of:

      Code:
      	D$ = "string with éèà"
      
      	PRINT #1,D$
      Kind regards, José


      [email protected]


      ------------------

      Comment


      • #4
        Most API calls works with pointers to strings, so in this case:
        Code:
        CALL CharToOem(BYVAL STRPTR(D$), BYVAL STRPTR(D$))
        Not sure if the string need to be zero terminated. Think Lance once
        said dynamic strings in PB are in fact zero terminated, even if we
        don't see the last CHR$(0).

        ------------------
        Did a quick test and above works "as is". No need for any extra CHR$(0)
        in other words..


        [This message has been edited by Borje Hagsten (edited September 07, 2001).]

        Comment

        Working...
        X