I know there is already have post: Classic ASP - How to convert a UTF-8 string to UCS-2?
But my situation another.
I want convert UTF-8 to UCS-2BE.
For example this text in UTF-8 "Мухтарам Мизоч" convert to this "CEB0@0<� 87>G".
For example in PHP i can use ready function iconv("utf-8","ucs-2be","Мухтарам Мизоч");
But in classical ASP can't find any solution.
This solution need for send Unicode SMS text via Kannel.
in kannel.conf in section SMSC add alt-charset = UCS-2 (or UCS-2BE) thats enough. Kannel well send to smsc in this charset.
So sick of answering this question, but I feel impelled to as you have made a common assumption that many make when it comes to encoding in ASP, PHP or whatever language you are using.
Just looking at the comments under the iconv reference made me laugh and sad at the same time because there are so many people out there who don't understand this topic.
Take for example your PHP snippet
This will work providing the following is true
UTF-8
encoding (Most modern editors have this option in some shape or form).The client Internet Browser knows it should be handling the page as
UTF-8
either via a meta tag in the HTML,or by specifying a HTTP Content-Type Header
In terms of Classic ASP it is the same you need to;
Make sure the page is saved as
UTF-8
encoding, this includes any#include
files that are dependencies.Tell IIS that your pages are
UTF-8
by specifying this pre-processing instruction at the very top of the page (must be the first line).Tell the browser what encoding you are using
UPDATE:
Neither
UCS-2
(UTF-16
LE) orUCS-2BE
(UTF-16
BE) are supported by Classic ASP, specifying eitherCodePage
(1200 or 1201) will result in;After reading a bit about Kannel it does appear as though you can control the character set you send to the SMS gateway, I would recommend you try to send it using
UTF-8
.Links
Sending arabic SMS in kannel (This question is about sending arabic SMS using Java to Kannel but the information is relevant).
Unicode on Windows XP (Although aimed at Windows XP the codepage information is still relevant).