Hello,
I need to be able to do the following and do not know how to do this. Here are the steps.
1. I receive a small XML file with a few lines like the following: <City><![CDATA[BRASÍLIA]]></City>
I am attempting to ready this in with the accent/diacritical
marks using NativeXML
I then need to take this and using Indy10 pass it out
as Unicode to a MySQL database to save it without
the special characters getting scrambled. My code currently
looks like this: (m_CustomerInfo is a record).
m_CustomerInfo.ShipCity := NodeByName('City').NodeByElementType(xeCData).ValueAsUnicodeString;
I then use this to send to the MySQL database:
function Submit_Customerinfo(URL, CITY: Widestring) : String;
var
MPS : TIdMultiPartFormDataStream;
theRESPONSE : String;
begin
theRESPONSE := 'Error: Not Successful in submitting Customer Information.';
try
MPS := TIdMultiPartFormDataStream.Create;
frmMAIN.HTTP.Request.ContentType := MPS.RequestContentType;
MPS.AddFormField('city', CITY);
MPS.Position := 0;
theRESPONSE := frmMAIN.HTTP.Post(URL, MPS);
finally
MPS.Free;
end;
Submit_Customerinfo := theRESPONSE;
end;
So I call Submit_Customerinfo as shown above with a URL
and the CITY string that I need to properly pass I guess
or should I change the parameters in the function from
WideString as well?
This is what I need help with. If the City name is just plain text it works great, but, not with the accents. It gets scrambled. So everything in the code works properly
except submitting accented characters.
Any help on how to do this or where to find a good article to read that can get me through this is appreciated.
Thanks,
Kim
I need to be able to do the following and do not know how to do this. Here are the steps.
1. I receive a small XML file with a few lines like the following: <City><![CDATA[BRASÍLIA]]></City>
I am attempting to ready this in with the accent/diacritical
marks using NativeXML
I then need to take this and using Indy10 pass it out
as Unicode to a MySQL database to save it without
the special characters getting scrambled. My code currently
looks like this: (m_CustomerInfo is a record).
m_CustomerInfo.ShipCity := NodeByName('City').NodeByElementType(xeCData).ValueAsUnicodeString;
I then use this to send to the MySQL database:
function Submit_Customerinfo(URL, CITY: Widestring) : String;
var
MPS : TIdMultiPartFormDataStream;
theRESPONSE : String;
begin
theRESPONSE := 'Error: Not Successful in submitting Customer Information.';
try
MPS := TIdMultiPartFormDataStream.Create;
frmMAIN.HTTP.Request.ContentType := MPS.RequestContentType;
MPS.AddFormField('city', CITY);
MPS.Position := 0;
theRESPONSE := frmMAIN.HTTP.Post(URL, MPS);
finally
MPS.Free;
end;
Submit_Customerinfo := theRESPONSE;
end;
So I call Submit_Customerinfo as shown above with a URL
and the CITY string that I need to properly pass I guess
or should I change the parameters in the function from
WideString as well?
This is what I need help with. If the City name is just plain text it works great, but, not with the accents. It gets scrambled. So everything in the code works properly
except submitting accented characters.
Any help on how to do this or where to find a good article to read that can get me through this is appreciated.
Thanks,
Kim