Guest User

EpgTimer_google_title.diff

a guest
Feb 14th, 2013
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.67 KB | None | 0 0
  1. --- PopupWindow.xaml.cs.orig    2013-02-15 13:46:17.591761600 +0900
  2. +++ PopupWindow.xaml.cs 2013-02-15 13:46:52.255850400 +0900
  3. @@ -34,12 +34,32 @@
  4.                      "(\\[[^\\]]+\\])+" +
  5.                      "|" +
  6.                      "([^】]+】)+" +
  7. +                    "|" +
  8. +                    "([^]]+])+" +
  9.                  ")";
  10.              foreach (string str1 in new string[] { "^((5.1)|" + markExp1 + ")+", markExp1 + "$" }) {
  11. -                keyword0 = Regex.Replace(keyword0, str1, string.Empty);
  12. +                keyword0 = Regex.Replace(keyword0, str1, string.Empty).Trim();
  13.              }
  14.              //
  15. -            this.proc_Browser = Process.Start("http://www.google.co.jp/#hl=ja&sclient=psy-ab&q=" + Uri.EscapeUriString(keyword0));
  16. +            this.proc_Browser = Process.Start("https://www.google.co.jp/search?hl=ja&q=" + UrlEncode(keyword0, System.Text.Encoding.UTF8));
  17. +        }
  18. +
  19. +
  20. +        //
  21. +        // HttpUtility を使わないUrlEncodeの実装
  22. +        // From http://d.hatena.ne.jp/kazuv3/20080605/1212656674
  23. +        //
  24. +        public static string UrlEncode(string s, System.Text.Encoding enc)
  25. +        {
  26. +            System.Text.StringBuilder rt = new System.Text.StringBuilder();
  27. +            foreach (byte i in enc.GetBytes(s))
  28. +                if (i == 0x20)
  29. +                    rt.Append('+');
  30. +                else if (i >= 0x30 && i <= 0x39 || i >= 0x41 && i <= 0x5a || i >= 0x61 && i <= 0x7a)
  31. +                    rt.Append((char)i);
  32. +                else
  33. +                    rt.Append("%" + i.ToString("X2"));
  34. +            return rt.ToString();
  35.          }
  36.  
  37.          public void show(string text0) {
Add Comment
Please, Sign In to add comment