I try to create an interaction between Emacs and other applications, e. g. Microsoft Office.
For example I have defined a VBA Macro in MS Outlook which starts a search in Emacs:
strEmacsclientPath = "C:\emacs\emacs-24.3\bin\emacsclient.exe" strShellCommand = strEmacsclientPath & " -c --eval " & Chr(34) & "(org-search-view nil" & Chr(34) & Chr(34) & Chr(34) _ & strSearchText _ & Chr(34) & Chr(34) & Chr(34) & ")" & Chr(34) Call Shell(strShellCommand, vbHide) This works, but if the text to search (defined in variable strSearchText ) contains special characters like äöü, it fails, as e. g. with the search term "für", in Emacs I get
Search words: f\374r In consequence, it also does not find real occurrences of the search term "für".
How can I avoid that?
I've redefined the encoding settings, as I also had problems in the past:
(prefer-coding-system 'utf-8) (setq coding-system-for-read 'utf-8) (setq coding-system-for-write 'utf-8) Here are the complete current encoding settings (obtained with C-h C RET)
Coding system for saving this buffer: U -- utf-8-dos (alias: mule-utf-8-dos)
Default coding system (for new files): U -- utf-8 (alias: mule-utf-8)
Coding system for keyboard input: 1 -- iso-latin-1-unix (alias: iso-8859-1-unix latin-1-unix)
Coding system for terminal output: * -- cp1252 (alias of windows-1252)
Coding system for inter-client cut and paste: U -- utf-16le-dos
Defaults for subprocess I/O: decoding: U -- utf-8-unix (alias: mule-utf-8-unix)
encoding: U -- utf-8-unix (alias: mule-utf-8-unix)
Priority order for recognizing coding systems when reading files: 1. utf-8 (alias: mule-utf-8)
2. iso-2022-7bit
3. iso-latin-1 (alias: iso-8859-1 latin-1)
4. iso-2022-7bit-lock (alias: iso-2022-int-1)
5. iso-2022-8bit-ss2
6. emacs-mule
7. raw-text
8. iso-2022-jp (alias: junet)
9. in-is13194-devanagari (alias: devanagari)
10. chinese-iso-8bit (alias: cn-gb-2312 euc-china euc-cn cn-gb gb2312)
11. utf-8-auto
12. utf-8-with-signature
13. utf-16
14. utf-16be-with-signature (alias: utf-16-be)
15. utf-16le-with-signature (alias: utf-16-le)
16. utf-16be
17. utf-16le
18. japanese-shift-jis (alias: shift_jis sjis)
19. chinese-big5 (alias: big5 cn-big5 cp950)
20. undecidedOther coding systems cannot be distinguished automatically from these, and therefore cannot be recognized automatically with the present coding system priorities.
Particular coding systems specified for certain file names:
OPERATION TARGET PATTERN CODING SYSTEM(s)
--------- -------------- ----------------
File I/O "\.dz\'" (no-conversion . no-conversion) "\.xz\'" (no-conversion . no-conversion)
"\.lzma\'" (no-conversion . no-conversion)
"\.lz\'" (no-conversion . no-conversion)
"\.g?z\'" (no-conversion . no-conversion)
"\.\(?:tgz\|svgz\|sifz\)\'"
(no-conversion . no-conversion) "\.tbz2?\'" (no-conversion . no-conversion) "\.bz2\'" (no-conversion . no-conversion)
"\.Z\'" (no-conversion . no-conversion)
"\.elc\'" utf-8-emacs "\.utf\(-8\)?\'" utf-8
"\.xml\'" xml-find-file-coding-system
"\(\`\|/\)loaddefs.el\'"
(raw-text . raw-text-unix) "\.tar\'" (no-conversion . no-conversion) "\.po[tx]?\'\|\.po\."
po-find-file-coding-system "\.\(tex\|ltx\|dtx\|drv\)\'" latexenc-find-file-coding-system "" find-buffer-file-type-coding-system Process I/O "[pP][lL][iI][nN][kK]" (undecided-dos . undecided-dos) "[cC][mM][dD][pP][rR][oO][xX][yY]" (undecided-dos . undecided-dos) Network I/O nothing specified
\374is an octal character. Emacs likes UTF-8 but Windows uses UTF-16. But by default on Windows Emacs should play nicely. What are your current encoding settings? UseC-h C RETto look at some of them.iso-latin-1-dosis my default. Are you modifying the settings in yourinit.el?