asp-classickannel

Classic ASP - How to convert a UTF-8 string to UTF-16?


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.


Solution

  • 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.

    In web development encoding is intrinsically linked to

    The source encoding you use to save the web page

    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

    iconv("utf-8","ucs-2be","Мухтарам Мизоч");
    

    This will work providing the following is true


    In terms of Classic ASP it is the same you need to;


    UPDATE:

    Neither UCS-2 (UTF-16 LE) or UCS-2BE (UTF-16 BE) are supported by Classic ASP, specifying either CodePage (1200 or 1201) will result in;

    ASP 0203 - Invalid CodePage Value

    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