The utf8 encoding error

The utf8 encoding error SearchSearch
Author Message
russell
New member
Username: Flosed

Post Number: 1
Registered: 05-2005
Posted on Thursday, August 18, 2005 - 08:46 am:   

hello everyone!

I post the mms message through mm7 interface .It work well when use english . but don't work when I replace the content to chinese character


here is the mm7 soap:

POST /mm7 HTTP/1.1
Host:www.mmssdk.com
Content-type: multipart/mixed; boundary="mime-boundary-e8bbc8db-917b-4d92-b217-5b511ed9f210";type=text/xml; start="MM_7"
Content-Length: 2862
Connection: close
SOAPAction: ""

--mime-boundary-e8bbc8db-917b-4d92-b217-5b511ed9f210
Content-type:text/xml; charset=utf-8
Content-ID:MM_7

<?xml version='1.0' ?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<h3:TransactionID xsi:type="SOAP-ENC:string" SOAP-ENV:mustUnderstand="1" xmlns:h3="MM7" SOAP-ENC:root="1">XXXXXX</h3:TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<a1:SubmitReq id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/MMSComposition/MMSCompose">
<MM7Version xsi:null="1"/>
<SenderIdentification>
<VASPID xsi:null="1"/>
<VASID xsi:null="1"/>
</SenderIdentification>
<SenderAddress></SenderAddress>
<Recipients>
<To>12345678901</To>
<Cc></Cc>
<Bcc></Bcc>
</Recipients>
<ServiceCode xsi:null="1"/>
<LinkedID xsi:null="1"/>
<MessageClass>personal</MessageClass>
<TimeStamp>2005-08-18T14:37:23.8125000+08:00</TimeStamp>
<ExpiryDate>2005-08-18T14:37:23.8125000+08:00</ExpiryDate>
<EarliestDeliveryTime>2005-08-18T14:37:23.8125000+08:00</EarliestDeliveryTime>
<DeliveryReport>true</DeliveryReport>
<ReadReply>true</ReadReply>
<ReplyCharging>false</ReplyCharging>
<replyDeadline xsi:null="1"/>
<replyChargingSize xsi:null="1"/>
<Priority>high</Priority>
<Subject xsi:null="1"/>
<allowAdaptations>false</allowAdaptations>
<ChargedParty xsi:null="1"/>
<DistributionIndicator>false</DistributionIndicator>
<Content xsi:null="1"/>
<ContentType xsi:null="1"/>
<Content href="cid:mms_cid" />
</a1:SubmitReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--mime-boundary-e8bbc8db-917b-4d92-b217-5b511ed9f210
Content-type:multipart/related; start=<mysmil.smil>; boundary="mime-boundary-192c9dd8-4702-41ae-a176-a9245d3ee317"
Content-ID:<mms_cid>

--mime-boundary-192c9dd8-4702-41ae-a176-a9245d3ee317
Content-type:application/smil;
Content-ID: <mysmil.smil>

<smil>
<head>
<meta name="SDK USED" content="Mobile Technologies"/>
<meta name="CopyRight" content=""/>
<layout>
<root-layout width="200%" height="200%"/>
<region id="defaultImage" width="100%" height="50%" left="0" top="0" fit="fill"/>
<region id="defaultText" width="100%" height="50%" left="0" top="50%" fit="hidden"/>
</layout>
</head>
<body>
<par dur="1ms">
<text src="text_238365.txt"></text>
</par>
</body>
</smil>

--mime-boundary-192c9dd8-4702-41ae-a176-a9245d3ee317
Content-type:text/plain;
Content-ID:<text_238365.txt>
Content-location:text_238365.txt

测试内容
--mime-boundary-192c9dd8-4702-41ae-a176-a9245d3ee317--

--mime-boundary-e8bbc8db-917b-4d92-b217-5b511ed9f210--


I wonder whether the Content-Length: 2862 is right ,how could I caculate the lenngth .

thanks first



Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 4849
Registered: 10-2002
Posted on Thursday, September 01, 2005 - 08:19 pm:   

Make sure to encode the text as UTF-8, and change the "content-type:" header for that part to:

Content-type: text/plain; charset="utf-8"

Regarding the "content-length:" header, this should contain the number of bytes that follow the end of the HTTP header.

The HTTP header ends at the first blank line. So Content-Length should tell the number of bytes that follow that blank line (I'm referring to the blank line following "SOAPAction:" in your example above).

-bn