summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/spellcheck/hunspell/glue/mozHunspell.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
index 87ffbc661f..1535529c8d 100644
--- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
@@ -169,13 +169,20 @@ NS_IMETHODIMP mozHunspell::SetDictionary(const char16_t *aDictionary)
nsAutoCString dictFileName, affFileName;
- // XXX This isn't really good. nsIFile->NativePath isn't safe for all
- // character sets on Windows.
- // A better way would be to QI to nsIFile, and get a filehandle
- // from there. Only problem is that hunspell wants a path
-
+#ifdef XP_WIN
+ // nsIFile->NativePath isn't safe for all character sets on Windows.
+ // Use GetPath and pass it as a UTF-8 to the hunspell lib instead.
+ // Hunspell 1.5+ supports UTF-8 file paths on Windows
+ // by prefixing "\\\\?\\".
+ nsAutoString affFileNameU;
+ nsresult rv = affFile->GetPath(affFileNameU);
+ NS_ENSURE_SUCCESS(rv, rv);
+ affFileName.AssignLiteral("\\\\?\\");
+ AppendUTF16toUTF8(affFileNameU, affFileName);
+#else
nsresult rv = affFile->GetNativePath(affFileName);
NS_ENSURE_SUCCESS(rv, rv);
+#endif
if (mAffixFileName.Equals(affFileName.get()))
return NS_OK;