function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
china.leafchina.leaf 

please help me? how can i receive a parameter (encoding gb2312)

system.debug(System.Encodingutil.urlEncode('你好', 'gb2312'));

output  "%C4%E3%BA%C3"

 

system.debug(System.Encodingutil.urlEncode('你好', 'utf-8'));

output  "%E4%BD%A0%E5%A5%BD"

 

 

Page:

<apex:inputTextarea value="{!fchrMsg}" id="fchrMsg"/>

class:

    public string fchrMsg{
        get{
            if(fchrMsg == null){
                string fchrTmpMsg = ApexPages.currentPage().getParameters().get('msg');
                if(fchrTmpMsg != null)
                    fchrMsg = System.Encodingutil.urlDecode(fchrTmpMsg, 'gb2312');
                else
                    fchrMsg = '';
            }
            return fchrMsg;
        }
        set{
            fchrMsg = value;
        }
    }

I want to receive parameter by the url "mypage?msg=%C4%E3%BA%C3"

 

but i get a null value

 

Who can help me!

Message Edited by china.leaf on 05-12-2009 12:54 AM
Message Edited by china.leaf on 05-12-2009 01:27 AM
XactiumBenXactiumBen
It seems as though the url doesn't like %C4%E3%BA%C3 but it accepts the UTF-8 encoded equivalent.  Can't you encode and decode using UTF-8 instead?
china.leafchina.leaf
No, because the other party is a public interface, if it changed the code, then other users will not be able to receive the normal parameters