You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Revtools读取文献数据时西班牙语字符丢失问题求助

解决revtools读取WOS文献时西班牙语特殊字符丢失的问题

针对revtools::read_bibliography读取Web of Science数据时西班牙语特殊字符(如í)丢失的问题,可通过以下几种方式解决:

  • 手动指定编码读取文本后传入函数
    revtools::read_bibliography支持直接传入文本内容,因此可以先通过readLines指定正确编码读取文件,再将文本传递给函数:

    # 根据文件实际编码选择,比如UTF-16LE或Windows-1252
    bib_text <- readLines("H:/Bibliométrico/Datos Bibliográficos/SCIELO/SCIQN220722.txt", encoding = "UTF-16LE")
    mydata <- revtools::read_bibliography(text = bib_text)
    head(mydata$title)
    

    如果不确定文件实际编码,可在Windows PowerShell中用以下命令检测:

    Get-Content "H:/Bibliométrico/Datos Bibliográficos/SCIELO/SCIQN220722.txt" -Encoding Byte | Select-Object -First 4 | Format-Hex
    

    根据返回的字节判断编码(比如UTF-16LE会以FF FE开头)。

  • 借助编码转换工具修正文本
    如果读取后仍有编码问题,可通过iconv转换为UTF-8后再处理:

    bib_text <- readLines("H:/Bibliométrico/Datos Bibliográficos/SCIELO/SCIQN220722.txt", encoding = "Windows-1252")
    bib_text <- iconv(bib_text, from = "Windows-1252", to = "UTF-8")
    mydata <- revtools::read_bibliography(text = bib_text)
    
  • 用第三方包预处理数据
    若上述方法无效,可使用bibliometrix包先读取并转换WOS数据,再转为revtools兼容的格式:

    library(bibliometrix)
    # 指定编码读取WOS数据
    df <- convert2df("H:/Bibliométrico/Datos Bibliográficos/SCIELO/SCIQN220722.txt", 
                     dbsource = "wos", 
                     format = "plaintext", 
                     encoding = "UTF-16LE")
    # 导出为bib格式后用revtools读取
    write_bib(df, "temp_bib.bib")
    mydata <- revtools::read_bibliography("temp_bib.bib")
    

内容的提问来源于stack exchange,提问作者Roiadams

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 20:54:20