これが文字エンコーディングの問題かどうかはわかりません
私は asp.net ページに POST リクエストを作成し、XML を送信して、変数に値を取得しました。
String selectionXml = HttpUtility.UrlDecode(Request.Params["SELECTION"]);
これは私のxmlの例です
<?xml version="1.0" encoding="UTF-8"?>
<FeatureSet>
<Layer id="0adcf012">
<Class id="MyTable">
<ID>AAAAAAAmvEA=</ID>
<ID>AAAAAAC+5EA=</ID>
</Class>
</Layer>
</FeatureSet>
問題は、上記の文を実行すると、このxmlを取得することです
<?xml version="1.0" encoding="UTF-8"?>
<FeatureSet>
<Layer id="0adcf012">
<Class id="MyTable">
<ID>AAAAAAAmvEA=</ID>
<ID>AAAAAAC 5EA=</ID>
</Class>
</Layer>
</FeatureSet>
つまり、2 番目の ID タグ (AAAAAAC 5EA=) は、元の xml (AAAAAAC+5EA=) とは異なり、プラス記号 (+) なしで表示されます。
この問題を解決するにはどうすればよいですか?
編集:さらにコードを追加します。これは私のasp.netページです(mapguideライブラリを使用)
<%@ Page Language="C#" Debug="true" validateRequest="false"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="OSGeo.MapGuide" %>
<!-- #Include File="common.aspx" -->
<%
Response.Charset = "utf-8";
String sessionId;
String mapName;
String locale;
int target=0;
int popup=0;
String selectedLayer;
MgSelection selection = null;
sessionId = Request.Params["SESSION"];
mapName = Request.Params["MAPNAME"];
locale = Request.Params["LOCALE"];
target = int.Parse(Request.Params["TGT"]);
popup = int.Parse(Request.Params["POPUP"]);
selectedLayer = Request.Params["LAYERTARGET"];
bool todos = false;
try
{
// Initialize the Web Extensions and connect to the Server using
// the Web Extensions session identifier stored in PHP session state.
//MapGuideApi.MgInitializeWebTier (Constants.WebConfigPath);
InitializeWebTier();
MgUserInformation userInfo = new MgUserInformation(sessionId);
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgMap map = new MgMap(siteConnection);
map.Open(mapName);
// ----------------------------------------------------------
// Use the following code for AJAX or DWF Viewers
// This requires passing selection data via HTTP POST
MgReadOnlyLayerCollection layers = null;
**String selectionXml = HttpUtility.UrlDecode(Request.Params["SELECTION"]);**
if (selectionXml!= null)
{
selection = new MgSelection(map, selectionXml);
layers = selection.GetLayers();
}
..........