Response.Expandtemplate(lcTemplate,"text/html",.F.,.T.)
I get an empty string returned. I notice the last parameter is no longer documented so I am wondering if that has been disabled.
TIA
Michael
www.WebConnectionHosting.com
Response.Expandtemplate(lcTemplate,"text/html",.F.,.T.)
I get an empty string returned. I notice the last parameter is no longer documented so I am wondering if that has been disabled.
TIA
Michael
www.WebConnectionHosting.com
The string output option has been removed a few years ago with the wwPageResponse class. Returning the string caused a bit of overhead for write operations so that feature has been removed.
You have a few options.
If all you want is the output from ExpandTemplate you can call ExpandTemplate and then look at Response.cOutput as that's where output gets generated:
Response.ExpandTemplate(lcPhysicalPath) lcHtml = Response.cOutput
Or you can take the more explicit route which is to just use MergeText directly:
loEval = CREATEOBJECT([WWC_wwEval]) lcHtml = loEval.MergeText(File2Var(lcPhysicalPath))
I would opt for the latter as it's more explicit and you don't have to know about the innards of WWC.
+++ Rick ---
Response.Expandtemplate(lcTemplate,"text/html",.F.,.T.)
I get an empty string returned. I notice the last parameter is no longer documented so I am wondering if that has been disabled.
TIA
Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.
I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").
To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):
lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"
So I then sent it through STRCONV() to try to get it encoded properly:
lcURL = STRCONV(lcURL,9)
What I get is this - the accented character gets converted to 2 characters:
http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580
So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?
Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.
Thanks.
Michael
www.WebConnectionHosting.com
From: | Rick Strahl |
To: | Albert Gostick |
This is how this works:
DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN
This will get you:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
+++ Rick ---
Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.
I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").
To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):
lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"
So I then sent it through STRCONV() to try to get it encoded properly:
lcURL = STRCONV(lcURL,9)
What I get is this - the accented character gets converted to 2 characters:
http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580
So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?
Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.
Thanks.
From: | Rick Strahl |
To: | Stein Goering |
+++ Rick ---
--stein
What is the date type exactly? The Sql fields should use DateTime to be usable in FoxPro not SQL Server Date fields. Old ODBC drivers won't understand date fields and that's my guess what's happening. Using a more recent SQL Server ODBC driver should fix this however. Still you should always use DateTime fields if you want to map to FoxPro dates.
+++ Rick ---
I have been using the wwBusiness class for a while now and it works great. Now we want to "flip the switch" and access SQL server instead of DBF files.
Everything is working good, except for date fields.
When I pull a cursor, the date fields come over as character type in YYYY-MM-DD format.
I have tried various things like Cast() and Convert() but can not get a date type field returned.
What is the trick to get a VFP date field returned in the cursor from SQL server ?
Thanks,
Kent
From: | Rick Strahl |
To: | Rick Strahl |
+++ Rick ---
This is how this works:
DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN
This will get you:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
+++ Rick ---
Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.
I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").
To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):
lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"
So I then sent it through STRCONV() to try to get it encoded properly:
lcURL = STRCONV(lcURL,9)
What I get is this - the accented character gets converted to 2 characters:
http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580
So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?
Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.
Thanks.
From: | Kent Belan |
To: | Stein Goering |
Thanks for the information. I have done more testing and when I query a DateTime field on the SQL server it returns a DateTime type field. When I query a Date Field on SQL server it returns a character field.
We are using SQL server 2008 v10.0.5500 and ODBC driver 11 for SQL server v2011.110.2270
Do you think we need to upgrade to SQL server 2012 ?
Thanks,
Kent
--stein
What is the date type exactly? The Sql fields should use DateTime to be usable in FoxPro not SQL Server Date fields. Old ODBC drivers won't understand date fields and that's my guess what's happening. Using a more recent SQL Server ODBC driver should fix this however. Still you should always use DateTime fields if you want to map to FoxPro dates.
+++ Rick ---
I have been using the wwBusiness class for a while now and it works great. Now we want to "flip the switch" and access SQL server instead of DBF files.
Everything is working good, except for date fields.
When I pull a cursor, the date fields come over as character type in YYYY-MM-DD format.
I have tried various things like Cast() and Convert() but can not get a date type field returned.
What is the trick to get a VFP date field returned in the cursor from SQL server ?
Thanks,
Kent
******** After I do a File Upload. Using a command like this.this.err = loFTP.FTPSendFileEx (SrcFileName, DstFileName)******** Then when I do:DIMENSION laFiles[1,4] nFiles= loFTP.aFTPDir(@laFiles,"*.*") && when BLOCKED this takes a while to excute.
I keep getting nFiles = 0, while there are actually file up there. The aFTPDir function works fine before the upload function.
The only way I have figured a way around it, is to Logoff and then LogIn again.
Then the nFiles = 10 or whatever.
I have checked and rechecked my parameters, but there are not that many.
Am I stepping on something? Is this a known issue?
Thanks
Seems to me if one must lookup the processing of a charge, having more data is better not worse. From what I have found, the result does not include the credit card number but does have their tracking number.
this.cHttpResult = loHTTP.HTTPGet(this.cHttpLink); ... process user feedback ... THIS.LogTransaction(THIS.cCompany + ", " + THIS.cName + " - " + ;LEFT(this.cCardNo,4) + " **** **** " + RIGHT(this.cCardNo,4) + " - " +;THIS.cValidatedResult)
Any pitfalls to adding the raw transaction response?
--hm
--hm--
From: | Albert Gostick |
To: | Rick Strahl |
Ok. got it. So I guess you just URLEncode the parts of the string that you expect to have upper ascii characters? I tried wrapping the whole url in URLEncode() but that (now obviously) did not work. I looked at your code in URLEncode() and it encodes everything except a specific set of characters.
Thanks,
Albert
This is how this works:
DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN
This will get you:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
+++ Rick ---
Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.
I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").
To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):
lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"
So I then sent it through STRCONV() to try to get it encoded properly:
lcURL = STRCONV(lcURL,9)
What I get is this - the accented character gets converted to 2 characters:
http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580
So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?
Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.
Thanks.
From: | Albert Gostick |
To: | Rick Strahl |
I think this response probably had to do with another thread, fyi.
Albert
+++ Rick ---
This is how this works:
DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN
This will get you:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:
http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick
+++ Rick ---
Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.
I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").
To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):
lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"
So I then sent it through STRCONV() to try to get it encoded properly:
lcURL = STRCONV(lcURL,9)
What I get is this - the accented character gets converted to 2 characters:
http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580
So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?
Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.
Thanks.
From: | Albert Gostick |
To: | Albert Gostick |
Got that working on two of the calls to this server (.CreateFolder() and .UpdateFolder()) so that the accented name appears correct on the folder.
Next one I could not get working - this one is .AddDocument() which adds a doc to a folder. This one was done via using a multi-part form to push up a document to the server. If the document title contains an accented character, cannot get it to post properly.
Here is the code I was using. Note that .ioHTTP is an instance of your wwhttp class. And,
tcDocFileName: full path and name of file to upload
tcDocTitle: above with pathing removed
STORE 2 TO .ioHTTP.nHTTPPostMode .ioHTTP.AddPostKey(tcDocTitle,tcDocFileName,.T.) * encode the doc title (not the doc file name); not: do this after .AddPostKey()STORE URLEncode(STRCONV(tcDocTitle,9)) TO tcDocTitle* work up the URL to the Nuxeo serverSTORE .icNuxeoAPIUrl + "/adddocument/" + .icUserName + "/" + tcFolder_ID + "/" + tcDocTitle TO lcURLSTORE .ioHTTP.HttpGet(lcURL,.icUserName,.icUserPassword) TO lcResultString
Results:
a) if I don't use the URLEncode(), the doc title in the system gets truncated at the first accented character.
e.g. document title is "Phone call with Jos" when it should be "Phone call with Josée"
b) if I use the URLEncode(), then the title of the document comes through with the encoding still on it e.g.
Phone%20call%20with%20Jos%C3%A9e.txt
Here is the URL call if that helps (the long string after "Albie/" is a database id for the target folder). the last argument is the doc title
So if the code above looks correct, then I need to take it up with the developer of the web app. Or I just need instructions on how to post a document as a multipart form where the title has an accented character.
Thanks,
Albert
PdfStamper stamper = new PdfStamper(pdfReader, new FileStream(PDF_nme, FileMode.Create), '\0', true);
I think I've got everything converted properly, but I'm stuck on the '\0' parameter which is a "char" type. At least that's where I think my problem is. Whenever creating the loStamper object in the code below, I get the error: Constructor on type 'iTextSharp.text.pdf.PdfStamper' not found. I think it's because VFP is passing a string rather than a char. There is an overload where I can drop the last two parameters and it works, but I need those parameters. Is there a way to fix this in wwDotNetBridge?
loFileMode = loBridge.CreateComValue() loFileMode.SetValueFromStaticProperty("System.IO.FileMode", "Create") loFileStream = loBridge.CreateInstance("System.IO.FileStream", lcPDF_nme, loFileMode)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating System.IO.FileStream: " + loBridge.cErrorMsg)Return .f.EndIf loStamper = loBridge.CreateInstance("iTextSharp.text.pdf.PdfStamper", loPdfReader, loFileStream, Chr(0), .t.)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating iTextSharp.text.pdf.PdfStamper: " + loBridge.cErrorMsg)Return .f.EndIf
From: | Rick Strahl |
To: | Joel Leach |
+++ Rick ---
PdfStamper stamper = new PdfStamper(pdfReader, new FileStream(PDF_nme, FileMode.Create), '\0', true);
I think I've got everything converted properly, but I'm stuck on the '\0' parameter which is a "char" type. At least that's where I think my problem is. Whenever creating the loStamper object in the code below, I get the error: Constructor on type 'iTextSharp.text.pdf.PdfStamper' not found. I think it's because VFP is passing a string rather than a char. There is an overload where I can drop the last two parameters and it works, but I need those parameters. Is there a way to fix this in wwDotNetBridge?
loFileMode = loBridge.CreateComValue() loFileMode.SetValueFromStaticProperty("System.IO.FileMode", "Create") loFileStream = loBridge.CreateInstance("System.IO.FileStream", lcPDF_nme, loFileMode)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating System.IO.FileStream: " + loBridge.cErrorMsg)Return .f.EndIf loStamper = loBridge.CreateInstance("iTextSharp.text.pdf.PdfStamper", loPdfReader, loFileStream, Chr(0), .t.)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating iTextSharp.text.pdf.PdfStamper: " + loBridge.cErrorMsg)Return .f.EndIf
From: | Rick Strahl |
To: | Harvey Mushman |
If you want to log more detailed info you can do that at any time in your application. You can capture anything that comes in as a result including the HTTP response.
+++ Rick ---
Seems to me if one must lookup the processing of a charge, having more data is better not worse. From what I have found, the result does not include the credit card number but does have their tracking number.
this.cHttpResult = loHTTP.HTTPGet(this.cHttpLink); ... process user feedback ... THIS.LogTransaction(THIS.cCompany + ", " + THIS.cName + " - " + ;LEFT(this.cCardNo,4) + " **** **** " + RIGHT(this.cCardNo,4) + " - " +;THIS.cValidatedResult)
Any pitfalls to adding the raw transaction response?
--hm
If so there are problems with IE 11 and multi-connects.
Nothing's changed in wwFtp for quite a long while so I doubt that there's actually anything different from what you used before other than the environment.
http://west-wind.com/wconnect/weblog/ShowEntry.blog?id=898
+++ Rick ---
******** After I do a File Upload. Using a command like this.this.err = loFTP.FTPSendFileEx (SrcFileName, DstFileName)******** Then when I do:DIMENSION laFiles[1,4] nFiles= loFTP.aFTPDir(@laFiles,"*.*") && when BLOCKED this takes a while to excute.
I keep getting nFiles = 0, while there are actually file up there. The aFTPDir function works fine before the upload function.
The only way I have figured a way around it, is to Logoff and then LogIn again.
Then the nFiles = 10 or whatever.
I have checked and rechecked my parameters, but there are not that many.
Am I stepping on something? Is this a known issue?
Thanks
From: | Rick Strahl |
To: | Kent Belan |
+++ Rick ---
Thanks for the information. I have done more testing and when I query a DateTime field on the SQL server it returns a DateTime type field. When I query a Date Field on SQL server it returns a character field.
We are using SQL server 2008 v10.0.5500 and ODBC driver 11 for SQL server v2011.110.2270
Do you think we need to upgrade to SQL server 2012 ?
Thanks,
Kent
--stein
What is the date type exactly? The Sql fields should use DateTime to be usable in FoxPro not SQL Server Date fields. Old ODBC drivers won't understand date fields and that's my guess what's happening. Using a more recent SQL Server ODBC driver should fix this however. Still you should always use DateTime fields if you want to map to FoxPro dates.
+++ Rick ---
I have been using the wwBusiness class for a while now and it works great. Now we want to "flip the switch" and access SQL server instead of DBF files.
Everything is working good, except for date fields.
When I pull a cursor, the date fields come over as character type in YYYY-MM-DD format.
I have tried various things like Cast() and Convert() but can not get a date type field returned.
What is the trick to get a VFP date field returned in the cursor from SQL server ?
Thanks,
Kent