Archived

This forum has been archived. Please start a new discussion on GitHub.

std::string in interface

Hi,
I have numerous interfaces which use sequence of records which contains string fields.
They have all worked for months, and now I wrote another which delivers garbage back to the client. It seems to have valid data misalligned, with a few low value bytes sprinkled in.
I have added clean database data to make sure it's not a database record problem. The data fields of the record on the server side are clean just before being pushed onto the vector.

I was reading a recient message here -- Casting char* to std::string which refers to using sequence<byte> to handle string data. My assumption in reading this was that it refered to cases where binary data might be contained in the string. Am I correct in that string data with text data should be handled properly in interface definitions?

I am seeing this error from a PHP client, which receives an array of records which contains string fields.

Comments

  • mes
    mes California
    Hi Don,

    It would really help us to see an example of what your application is doing, such as the Slice types involved and some sample PHP code. Do the strings that you're transmitting use plain ASCII?

    You are correct in that you should use strings to handle text data, and sequence<byte> to handle binary blobs.

    As always, we also need to know the exact versions of Ice, PHP, operating system and compiler. Some users put this information in their signature, which is handy for us. :)

    Take care,
    - Mark