Announcement

Collapse
No announcement yet.

Icelandic characters in DOS filenames

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

  • Icelandic characters in DOS filenames

    I am using Windows DIR /c

    My directory is: c:\Isl
    English.txt
    Eða.txt
    Áéíóúýþæðö.txt
    Ísland.txt

    I run this program :

    #Include "Win32api.inc"
    Function PBMain
    Local LastFile As String,AsciiBuff As String
    Shell "cmd /c dir c:\isl\*.* /b > dir.dir"
    Open "dir.dir" For Input As 1
    While Not Eof(1)
    Line Input #1,LastFile
    AsciiBuff = Space$(Len(LastFile)+1)
    CharToOem ByVal StrPtr(LastFile),ByVal StrPtr(AsciiBuff)
    Err=0
    Open "c:\isl\"+AsciiBuff For Input As 2
    ? AsciiBuff "->";Error$(Err)
    Close 2
    Wend
    Close 1
    End Function



    And my output is:

    English.txt->No Error
    EÐa.txt->File not found
    µ'¡¢£ìç'Ð".txt->Path/file access error
    Ösland.txt->File not found

    Still unable to open files with Icelandic char.
    Magnus Soffaniasson
    http://vdsl.is

  • #2
    You should be able to use any extended ASCII character except CHR$(229). I can't tell if you have that in your file names.

    CHR$(229) is reserved in that it sets up the DELeted flag for a file for the O/S so if you do use it, you will probably error out.

    At least I think it's CHR$(229). Pretty sure. It's been a while since I had to take it into consideration.
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      Code:
      AsciiBuff = Space$(Len(LastFile)+1)
      CharToOem ByVal StrPtr(LastFile),ByVal StrPtr(AsciiBuff)
      AsciiBuff has a space at the end, so then too is the file name it's trying to open..

      Try:
      A: Only initialize ASciiBuff to LEN(LastFile), not Len(Lastfile) + 1
      B. Instead of spaces, try $NUL (CHR$(0))
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Hi,

        in your code you change the filename from ANSI to OEM. Why ?

        The filesystem since Windows NT is in ANSI.

        Why do you use the shell command, instead of the DIR$ function, this function will always get the right name for operations.
        Regards,
        Hubert

        ------------------------------------
        http://familie-brandel.de/index_e.html

        Comment

        Working...
        X