Merge lp://qastaging/~jonathanlambrechts/do-plugins/chromium into lp://qastaging/do-plugins

Proposed by Jonathan Lambrechts
Status: Merged
Approved by: Alex Launi
Approved revision: 659
Merged at revision: not available
Proposed branch: lp://qastaging/~jonathanlambrechts/do-plugins/chromium
Merge into: lp://qastaging/do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~jonathanlambrechts/do-plugins/chromium
Reviewer Review Type Date Requested Status
Alex Launi (community) Approve
Review via email: mp+9368@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Lambrechts (jonathanlambrechts) wrote :

Hi,
I did not notice that special character were escaped in the chromium bookmarks file.
They are converted now.

Jonathan

Revision history for this message
Alex Launi (alexlauni) wrote :

looks good, mergine.
thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Chromium/Makefile.am'
2--- Chromium/Makefile.am 2009-07-24 17:22:10 +0000
3+++ Chromium/Makefile.am 2009-07-28 12:47:57 +0000
4@@ -11,7 +11,5 @@
5 REFERENCES = \
6 System \
7 System.Core \
8- System.Data \
9- Mono.Data.SqliteClient \
10 $(DO_PLATFORM_LIBS) \
11 $(DO_UNIVERSE_LIBS)
12
13=== modified file 'Chromium/src/ChromiumBookmarkItemSource.cs'
14--- Chromium/src/ChromiumBookmarkItemSource.cs 2009-07-25 05:33:43 +0000
15+++ Chromium/src/ChromiumBookmarkItemSource.cs 2009-07-28 13:02:51 +0000
16@@ -20,6 +20,7 @@
17 using System;
18 using System.Collections.Generic;
19 using System.IO;
20+using System.Globalization;
21 using System.Text.RegularExpressions;
22
23 using Mono.Addins;
24@@ -59,6 +60,15 @@
25 get { return items; }
26 }
27
28+ static string UnescapeUTF8 (string s) {
29+ foreach (Match m in Regex.Matches (s, @"\\u([0-9A-F]{4})")) {
30+ char c = (char) int.Parse (m.Groups[1].Value, NumberStyles.HexNumber);
31+ s = s.Replace (m.Groups[0].Value, c.ToString());
32+ }
33+ return s;
34+ }
35+
36+
37 public override void UpdateItems ()
38 {
39 string type = "", name = "", url = "";
40@@ -66,7 +76,7 @@
41 string bookmarksFile = "~/.config/chromium/Default/Bookmarks".Replace ("~", home);
42 try {
43 Regex RE = new Regex ("(\"([^\"]*)\" *: *\"([^\"]*)\")|[{}]", RegexOptions.Multiline);
44- FileStream fs = new FileStream (bookmarksFile, FileMode.Open,FileAccess.Read);
45+ FileStream fs = new FileStream (bookmarksFile, FileMode.Open, FileAccess.Read);
46 StreamReader reader = new StreamReader (fs);
47
48 items.Clear ();
49@@ -78,7 +88,7 @@
50 name = "";
51 }
52 else if (m.Value == "}" && type == "url" && !string.IsNullOrEmpty (name) && !string.IsNullOrEmpty (url)) {
53- items.Add (new BookmarkItem (name, url));
54+ items.Add (new BookmarkItem (UnescapeUTF8(name), url));
55 }
56 else if (m.Value.StartsWith ("\"")) {
57 if (m.Groups [2].Value == "url")
58@@ -98,4 +108,4 @@
59 }
60 }
61 }
62-}
63\ No newline at end of file
64+}

Subscribers

People subscribed via source and target branches