Coder Social home page Coder Social logo

luoxu-bot's Issues

搜索时报错:illegal fieldName 和 StringIndexOutOfBoundsException

已经搭建好luoxu和luoxu-bot,测试web版本功能正常,bot输入/list可以返回正确的索引列表
当输入搜索内容时,若搜索内容为中文,报错:

com.alibaba.fastjson2.JSONException: illegal fieldName inputI, offset 1, character I, line 1, column 2, fastjson-version 2.0.17 Invalid char in url query:

  b'GET /luoxu/search?q=\xe6\xb5\x8b\xe8\xaf\x95&g=1317151537 HTTP/1.1'
                        ^
        at com.alibaba.fastjson2.JSONReaderASCII.readFieldNameHashCode(JSONReaderASCII.java:136)
        at com.alibaba.fastjson2.reader.ObjectReaderNoneDefaultConstructor.readObject(ObjectReaderNoneDefaultConstructor.java:223)
        at com.alibaba.fastjson2.JSON.parseObject(JSON.java:600)
        at methods.AfterSearchKt.afterSearch(afterSearch.kt:77)
        at MainKt$main$bot$1$1$3.invoke(Main.kt:21)
        at MainKt$main$bot$1$1$3.invoke(Main.kt:21)
        at com.github.kotlintelegrambot.dispatcher.handlers.CallbackQueryHandler.handleUpdate(CallbackQueryHandler.kt:38)
        at com.github.kotlintelegrambot.dispatcher.Dispatcher.handleUpdate(Dispatcher.kt:66)
        at com.github.kotlintelegrambot.dispatcher.Dispatcher.checkQueueUpdates(Dispatcher.kt:35)
        at com.github.kotlintelegrambot.dispatcher.Dispatcher.startCheckingUpdates$lambda-0(Dispatcher.kt:28)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

若搜索内容为英文,报错:

java.lang.StringIndexOutOfBoundsException: begin -189, end 187, length 1669
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
        at java.base/java.lang.String.substring(String.java:1874)
        at BotUtilsKt.highlight(BotUtils.kt:144)
        at BotUtilsKt.highlight$default(BotUtils.kt:128)
        at methods.AfterSearchKt.afterSearch(afterSearch.kt:57)
        at MainKt$main$bot$1$1$3.invoke(Main.kt:21)
        at MainKt$main$bot$1$1$3.invoke(Main.kt:21)
        at com.github.kotlintelegrambot.dispatcher.handlers.CallbackQueryHandler.handleUpdate(CallbackQueryHandler.kt:38)
        at com.github.kotlintelegrambot.dispatcher.Dispatcher.handleUpdate(Dispatcher.kt:66)
        at com.github.kotlintelegrambot.dispatcher.Dispatcher.checkQueueUpdates(Dispatcher.kt:35)
        at com.github.kotlintelegrambot.dispatcher.Dispatcher.startCheckingUpdates$lambda-0(Dispatcher.kt:28)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
May 17, 2024 6:19:02 AM okhttp3.internal.platform.Platform log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.