Jump to content

Jmail Attachment With Japanese Characters


andersbundgaard

Recommended Posts

Hi everybodyI am using this script to send attached text-files to my clients:(I have omitted some irrelevant code)<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><%Set JMail = Server.CreateObject("JMail.SMTPMail")JMail.serverAddress = serveraddressJMail.sender = senderemailJMail.SenderName = sendernameJMail.Subject = subjectJMail.addRecipient emailfolderaddr=Server.MapPath("../../userDB/userdata/user"&userID)Set FS = Server.CreateObject("Scripting.FileSystemObject")If FS.FolderExists(folderaddr) = true ThenSet FO = FS.GetFolder(folderaddr)for each x in FO.filesif (FS.FileExists(x))=true thenJMail.AddAttachment xend ifnextset FO=Nothingfolderstatus="ok"elsefolderstatus="folder does not exist"end ifset FS=NothingJmail.Htmlbody= htmlmessageJMail.priority = 3Jmail.ExecuteJmail.ClearRecipients%></body></html>Everything works fine as long as the names of the text-documents are in Latin letters such as name.txt, but when I use Japanese characters this error comes up:jmail.SMTPMail error '8000ffff'Cannot open file D:\web\localuser\lostudioitaliano.com\userDB\userdata\user547\???.txtAnd the error points to this line of code:JMail.AddAttachment xAs you can see the Japanese characters have been replaced by question marks (???.txt).The text-files are saved to the server in unicode using this: set tfile=fs.CreateTextFile(fileaddr, True, True)Could anyone please help me?I have searched everywhere, and I am lost...!Anders

Link to comment
Share on other sites

How about you save the text files without Japanese characters in their names? If Windows supports Unicode filenames I guess you can just make sure that your script is using Unicode instead of Latin.
ThanksWell, my pages are using unicode:CODEPAGE="65001"charset=utf-8- and I can display the Japanese characters without problems.My guess is that the problem is related to the Jmail-object.Is there any way to tell the object, that the file names are in unicode?Anders
Link to comment
Share on other sites

First, open the folder where you're saving the uploaded files and have it open when you test so that you can see the file get created. See if the file is actually getting created with Japanese characters or question marks.

Link to comment
Share on other sites

When I open the folder from within Dreamweaver and look at the files they look like this:^^^.txtBut still I think that they are saved as unicode names, because if I replace the lineJMail.AddAttachment xwithresponse.write(x.Name)- then the names with Japanese characters are displayed perfectly...Anders

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...