Is your input string UTF-8 encoded ( looks like char * with high bits ) or
Unicode 16 (two bytes per character)?
You should be able to do what you are trying to do, but you could always write
your own version of WriteString that used the WriteBytes API instead and just
txmit the data as raw binary. Maybe prepend the # of bytes before the data
gets put into the buffer.
Looking at bitbuf, there's nothing here which will strip the > 128 chars:
void bf_write::WriteChar(int val)
{
WriteSBitLong(val, sizeof(char) << 3);
}
bool bf_write::WriteString(const char *pStr)
{
if(pStr)
{
do
{
WriteChar( *pStr );
++pStr;
} while( *(pStr-1) != 0 );
}
else
{
WriteChar( 0 );
}
return !IsOverflowed();
}
Yahn
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James
Sent: Friday, June 02, 2006 11:56 PM
To: [email protected]
Subject: [hlcoders] bf_write and unsigned characters
--
[ Picked text/plain from multipart/alternative ]
I've been trying to output messages that contain thësê kïñd of chæråchtèrs
to allow for multiple languages in my server plugin. For example, I would
use this code to output a chat area message:
void ChatAreaMsg(int index, char *msg) {
MRecipientFilter filter;
bf_write *buffer;
filter.AddRecipient(index);
buffer =
engine->UserMessageBegin(static_cast<IRecipientFilter*>(&filter), 3);
buffer->WriteByte(0);
buffer->WriteString(msg);
buffer->WriteByte(0);
engine->MessageEnd();
return ;
}
However, when I attempt to write out a message that contains characters that
are greater than 128 (unsigned) in byte size, they get stripped. I've also
tried replacing the WriteChar() in the WriteString() function with
WriteByte() but I still get the same result. Is there any way to write these
kind of characters into a bf_write? Or is this problem occurring somewhere
else downstream where these characters may be getting stripped?
--
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders