[pal-cvs 2972] [716] convert to jis.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 11月 20日 (火) 15:04:26 JST


Revision: 716
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=716
Author:   shinsuke
Date:     2007-11-20 15:04:25 +0900 (Tue, 20 Nov 2007)

Log Message:
-----------
convert to jis.

Modified Paths:
--------------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserAddressSelectAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserInfoEditAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/signup/SignupConfirmAction.java


-------------- next part --------------
Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java	2007-11-20 04:14:11 UTC (rev 715)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java	2007-11-20 06:04:25 UTC (rev 716)
@@ -153,4 +153,40 @@
             ((RenderResponse) response).setTitle(title);
         }
     }
+
+    public static String convertToJIS(String s) {
+        if (s == null) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        char c;
+        for (int i = 0; i < s.length(); i++) {
+            c = s.charAt(i);
+            switch (c) {
+            case 0xff3c: // FULLWIDTH REVERSE SOLIDUS ->
+                c = 0x005c; // REVERSE SOLIDUS
+                break;
+            case 0xff5e: // FULLWIDTH TILDE ->
+                c = 0x301c; // WAVE DASH
+                break;
+            case 0x2225: // PARALLEL TO ->
+                c = 0x2016; // DOUBLE VERTICAL LINE
+                break;
+            case 0xff0d: // FULLWIDTH HYPHEN-MINUS ->
+                c = 0x2212; // MINUS SIGN
+                break;
+            case 0xffe0: // FULLWIDTH CENT SIGN ->
+                c = 0x00a2; // CENT SIGN
+                break;
+            case 0xffe1: // FULLWIDTH POUND SIGN ->
+                c = 0x00a3; // POUND SIGN
+                break;
+            case 0xffe2: // FULLWIDTH NOT SIGN ->
+                c = 0x00ac; // NOT SIGN
+                break;
+            }
+            sb.append(c);
+        }
+        return new String(sb);
+    }
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserAddressSelectAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserAddressSelectAction.java	2007-11-20 04:14:11 UTC (rev 715)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserAddressSelectAction.java	2007-11-20 06:04:25 UTC (rev 716)
@@ -18,6 +18,7 @@
 import jp.sf.pal.pompei.service.CustomerService;
 import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.util.SessionUtil;
+import jp.sf.pal.pompei.util.SystemUtil;
 
 import org.seasar.teeda.extension.annotation.takeover.TakeOver;
 import org.seasar.teeda.extension.annotation.takeover.TakeOverType;
@@ -131,6 +132,11 @@
 
     @TakeOver(type = TakeOverType.INCLUDE, properties = "orderProcessId")
     public Class<?> doAdd() {
+        // convert cp932 to jis
+        getUserAddressSelectPage().setStreetAddress(
+                SystemUtil.convertToJIS(getUserAddressSelectPage()
+                        .getStreetAddress()));
+
         // check login
         String remoteUser = FacesContext.getCurrentInstance()
                 .getExternalContext().getRemoteUser();

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserInfoEditAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserInfoEditAction.java	2007-11-20 04:14:11 UTC (rev 715)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/checkout/UserInfoEditAction.java	2007-11-20 06:04:25 UTC (rev 716)
@@ -23,6 +23,7 @@
 import jp.sf.pal.pompei.service.CustomerService;
 import jp.sf.pal.pompei.service.LanguageService;
 import jp.sf.pal.pompei.util.SessionUtil;
+import jp.sf.pal.pompei.util.SystemUtil;
 
 import org.seasar.teeda.extension.annotation.takeover.TakeOver;
 import org.seasar.teeda.extension.annotation.takeover.TakeOverType;
@@ -183,6 +184,11 @@
     }
 
     public Class<?> doUpdate() {
+        // convert cp932 to jis
+        getUserInfoEditPage().setStreetAddress(
+                SystemUtil.convertToJIS(getUserInfoEditPage()
+                        .getStreetAddress()));
+
         // check email
         if (!getUserInfoEditPage().getEmailAddress().equals(
                 getUserInfoEditPage().getEmailAddressConfirm())) {

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/signup/SignupConfirmAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/signup/SignupConfirmAction.java	2007-11-20 04:14:11 UTC (rev 715)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/signup/SignupConfirmAction.java	2007-11-20 06:04:25 UTC (rev 716)
@@ -66,6 +66,10 @@
 
     @TakeOver(type = TakeOverType.INCLUDE, properties = "emailAddress")
     public Class<?> doOnceCreate() {
+        // convert cp932 to jis
+        getSignupConfirmPage().setStreetAddress(
+                SystemUtil.convertToJIS(getSignupConfirmPage()
+                        .getStreetAddress()));
 
         // new
         Date now = new Date();


pal-cvs メーリングリストの案内
Back to archive index