summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-18 16:33:00 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-18 16:33:00 +0800
commit906b2ada8489734323e3a45b0cf4f61e97268138 (patch)
tree17f039abc55e0c92336f802a91126b387b0e93e8 /script/files.lua
parente652c6d395d68ab07f6aef6b4ea988342b76b410 (diff)
downloadlua-language-server-906b2ada8489734323e3a45b0cf4f61e97268138.zip
fix unicode on Linux and macOS
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/script/files.lua b/script/files.lua
index f460f350..b609b2c3 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -1,5 +1,4 @@
local platform = require 'bee.platform'
-local unicode = require 'bee.unicode'
local config = require 'config'
local glob = require 'glob'
local furi = require 'file-uri'
@@ -14,6 +13,12 @@ local guide = require 'parser.guide'
local smerger = require 'string-merger'
local progress = require "progress"
+local unicode
+
+if platform.OS == 'Windows' then
+ unicode = require 'bee.unicode'
+end
+
local m = {}
m.openMap = {}
@@ -154,7 +159,7 @@ function m.setText(uri, text, isTrust)
if file.trusted and not isTrust then
return
end
- if not isTrust then
+ if not isTrust and unicode then
if config.config.runtime.sourceCoding == 'ansi' then
text = unicode.a2u(text)
end