Minggu, 03 Februari 2013

[MS_AccessPros] Re: Handling special Characters in MsAccess

 

sorry I couldn't answer before and can't give your question the full attention it deserves.

IN principle, if you are using identical means to access the files after you have stored the names, there should not be a problem. No matter what you read from the filesystem object, you should be able to access those files gain using the filesystem object as the storage in the Access tables should be transparent (if it isn't then it opens up a whole can of worms...)

"Should"... I see you are using two operations which might not be transparent and I suspect your problem is in the second of these. Thefirst is, you have a procedure "NoQuote" which presumably does something to remove quotation marks from the strings so that you can build the SQL. This routine *might* be messing up the special characters. The second things is that you are using SQL in order to do the Insert and here is, I suspect, the problem. Could you riwerite the store routine to use DAO or ADO and save the field contents directly? soemthing along the lines of:

dim db as DAO.Database
dim rs as DAO.Recordset
...
set db = DBEngine()()
...
' then for the directory names...
set rs = db.openrecordset("file",dbOpenDynaset, dbAppendOnly)
...
rs.Addnew
rs!dir_nm = dir_nm
rs!...
...
rs.Update
...
'and the same for the filenames

--- In MS_Access_Professionals@yahoogroups.com, "Onno Knol" wrote:
>
> Thanks, Herr Ravenrohm, for your explanation.
>
> I checked the charmap and indeed magical world opens for me, but I do not quite understand it yet..
>
> Let me first answer some of your questions. My windows is in English and so is my msaccess version (2010)
> I read the files like this:
> First I create a directory tree:
>
> MyPath = rst!dir_fullname
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.GetFolder(ReQuote(MyPath))
> Set fc = f.SubFolders
> For Each F1 In fc
> MyName = F1.Name
> MyFullPath = MyPath & "\" & MyName
> sqltxt = "insert into dirtree (dir_nm,dir_fullname, dir_lev,dir_path) select '" _
> & NoQuote(MyName) & "','" & NoQuote(MyFullPath) & "'," & chklev + 1 & ",'" & NoQuote(MyPath) & "'"
> ExecSQL sqltxt
> Next F1
>
> Next I read files from these directories:
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set f = fso.GetFolder(ReQuote(DirNam))
> Set fc = f.Files
> For Each F1 In fc
> MyName = F1.Name
> If Right(MyName, MaskLen) = mask Then
> FullName = ReQuote(DirNam) & "\" & MyName
> MyStamp = F1.DateLastModified
> MyFileLen = F1.Size
> sqltxt = " INSERT INTO file (Dir_id, dir_nm, fullpath, FILENM, FILEDATE, filesize) " & _
> " SELECT " & Did & ",'" & NoQuote(DirNam) & "','" & NoQuote(FullName) & "','" & NoQuote(MyName) _
> & "','" & MyStamp & "','" & MyFileLen & "'"
> ExecSQL sqltxt
> End If
> Next F1
>
> So the files are stored in a table named file. Later on I do some analyses and move the files to an organized directory structure.
> There it goes wrong when a file has a special character, then I get messages like "file does not exist".
> Apparently reading it into the file table and then accessing it by name and full path leads to an error.
> Special characters then are shown as question marks - and I still am not sure what is really stored in the file table and what the font in which I present the table does.
> For presenting, in a form, this I just use the default Msaccess font which is Arial 8.
> If I check the filenames in the operating system, I see the special characters.
> If I look at them in Access, I see question marks.
>
> Can anybody explain how msaccess handles codepages? Does it just follow the operating system, or has it its own philosophy?
>
> Thanks, Onno
>
> Ps further answers to questions by others: It is just about the filenames, dot the comntents of files.
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "acravenrohm" wrote:
> >
> > Welcome to the wonderfully confusing and/or irritating world of international character sets, codepages, and fonts.
> >
> > You might, or might not, have a "real" problem. You might have the right characters stored in your database/tables and only have a problem with the default font you are using to display the data (or the "codepage" you are telling windows to use from the font.)
> >
> > Tink of it this way... unless you are taking extraordinary care you are going to end up using one character-width of memory for each character stored. If you are taking extraordinary care or you are using SQL Server with the modern defaults, "One character width" means 8-binary bits which means you can represent 256 different symbols (numbers) for each character position in your text. 256 symbols is not enough to represent every "letter" or symbol of every alphabet in the world so there are conventions which say that, say, Symbol 65 is a capital A and generally this will always be so but, if you are looking for German (or Norsk) Symbols/Letters you wil find them in some exotic position/numbering and, even worse, where you find a particular symbol will change from country to country depending on what the standards committees decided back then.
> >
> > If you want to get a taste of what I'm ranting about, start charmap.exe (press Windows-Key and R at the same time and type in charmap, hit enter.) In the standard view you can see that you can choose a font to view the characters, click on "extended/expanded/advanced view" and you get a new drop-down box called "characterset", and you will see that Windows normally does "Unicode" but you can see a list of DOS and Windows character sets and as you select different fonts and character sets you will see the symbols displayed changing (select "Arial" as font and swap between "middle" and "western" Europe to get a feel for it.
> >
> > I work in German versions of Windows and Access but we translated into English (no problem), French (no Problem), Spanish (no Problem), and then we needed to do Slovakien and Slovenien... one of the worked, one didn't and some of the characters ended up being invisible but width a large width (it would take too long to explain what really happened and I'm taking long enough as it is.)
> >
> > The questions this raises are: how are you reading the filenames? What language is Windows in? How is the field you are using to store the names defined? Where are you displaying the field contents, with which font? What language are you using in Access?
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "Onno Knol" wrote:
> > >
> > > Dear friends, I have an issue with special characters. Think of cyrillic cahracters, but also the Norsk "oe" These sometimes occurr in filenames that I read into a MsAccess table. In The msaccess code (via "Add watch" ) these are shown as Question marks (?) but I am not sure that they are really stored as a question mark. If I search for a "?" in a string you obviously do not find it ..
> > > Anyway, I get in trouble with processing these filenames further in my program. I can think of two things for a solution: setting some windows option (I mostly use Win7) that improves the handling of special characters, or to set some MSaccess option that I do not know. I use Msaccess 2010 and 2003, I both seem to have the problem. Anybody any Clue?
> > > Thanks for your help,
> > >
> > > Onno
> > >
> >
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar