From: Roger B. <ro...@ro...> - 2003-10-30 23:07:54
|
> When I try to read a packet with names less than 16 characters, it works > (the phone pads fields with nulls). But on the following packet, with a > 16 character name, I get an error. You can set raiseonunterminatedread to False. > Are there some attributes to STRING > that I can add that will help? The length of the string is available in > the packet, but is not located adjacent to the string itself. I guess the problem here is that the field has a length in bytes (including padding) as well as a length in characters. It even looks like the length in characters can be in a later field which makes things even nastier. If the raiseonunterminatedread doesn't work for you, you could derive a new string class (or add an argument to the existing one) that lets you truncate the characters to a certain size. It won't be much use when the length field is after the string field though. Roger |