Org-protocol can be used to send data from a browser to Emacs. For example, you can use a bookmarklet to send the current URL, title and selection from the browser into Emacs org-mode capture.
On a Windows system I found that this works fine with Emacs UTF-8 settings when using Chrome and IE, but the data sent from Firefox was not UTF-8 (or utf-16-le) encoded. To handle this I used a special capture template for Firefox:
(setq org-capture-templates
'(
("f" "Capture bookmark from firefox" entry (file+datetree "~/org/notes.org")
"* %?\n:PROPERTIES:\n:CODING: cp1252\n:END:\n%i\n %a" :empty-lines 1)
)
)
A function which runs after content is captured checks for the "CODING" property, if it is there it recodes the buffer and removes the property:
;; If the org property value of CODING is not nil, mark the (capture) buffer it and use recode-region to recode it to UTF-8.
(defalias 'jmn/recode-buffer-from-cp1252-to-utf-8
#'(lambda nil "Recodes a buffer from cp1252 to utf-8 encoding"
(message "recoding buffer!")
(interactive)
(mark-whole-buffer)
(recode-region (region-beginning) (region-end) 'cp1252 'utf-8)))
(add-hook 'org-capture-prepare-finalize-hook
'(lambda nil
(if(cdr(assoc "CODING"(org-entry-properties nil 'standard)))
(progn
(org-delete-property "CODING")
(jmn/recode-buffer-from-cp1252-to-utf-8)))))
Now text can be selected in the browser and sent to emacs org-mode capture using this bookmarklet code:
javascript:location.href='org-protocol://capture://f/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
When the capture is finalized, the data will be recoded to utf-8.