Giter VIP home page Giter VIP logo

Comments (12)

huahaiy avatar huahaiy commented on May 19, 2024 1

It seems to me that it's an emacs configuration problem. See Emacs Wiki. It shows an example with exactly the same symptom as you described, and it can be fixed by an emacs command.

I use Spacemacs, so everything is configured correctly already and I have never had this problem.

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

Here a minimal example for reproducing this behavior:

(require '[datalevin.core :as d])

;; -- buggy (with type specified in schema) --
(def schema {:bug {:db/valueType :db.type/string}})
(def conn (d/get-conn "bug.db" schema))

(d/transact! conn [{:bug "Ümläüt"}])

(d/q '[:find (pull ?e [*])
       :where
       [?e :bug]]
     @conn)
;; => ([{:db/id 1, :bug "��ml����t"}])

(d/close conn)

;; -- correct (without type specified in schema) --
(def conn (d/get-conn "correct.db" {}))

(d/transact! conn [{:bug "Ümläüt"}])

(d/q '[:find (pull ?e [*])
       :where
       [?e :bug]]
     @conn)
;; => ([{:db/id 1, :bug "Ümläüt"}])

Please let me know if I can help more.

  • Axel

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

Oh, version used is 0.4.18 btw. :-)

from datalevin.

huahaiy avatar huahaiy commented on May 19, 2024

I cannot reproduce this error with 0.4.19 on Linux, nor on Mac. Please let me know more information on your environment, e.g. which OS, Java version, editor, terminal, etc.

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

Hi, thanks for answering so quickly.

I'm on a Mac (Mac OS 11.2.2).

java --version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)

Clojure REPL via Emacs/Cider. deps.edn project.

I'll try with 0.4.19.

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

Same problem here with version 0.4.19. Unfortunately.
As if a 16 bit encoding is being used when the string type has been specified. Hm, strange.

from datalevin.

huahaiy avatar huahaiy commented on May 19, 2024

Can you try 0.4.20? Thanks

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

I tried now outside of Emacs/Cider. In Terminal in the same project folder. REPL started via clj. The "bug" was gone.
Sorry for making waves here and thanks again for your help.
The problem seems to be something with Emacs/Cider here. Will try in VS Code/Calva.

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

I will also try 0.4.20 in Emacs/Cider now.
...
0.4.20 changed the behavior. In the Cider REPL now the result of the find pull is
([{:db/id 1, :bug "?ml??t"}])

No longer 16 bit strangeness but unknown chars or something like that. Will open the exact same db in Terminal via clj to see, if it's only a display issue in Emacs/Cider.
...
No, same (faulty) result in Terminal when reading the db which has been created inside Emacs/Cider.

=> 0.4.20 changed something here but we are not completely there. :-)

Maybe there is one little change more ... that fixes this issue (even for Emacs/Cider)? I will look at the diff between 0.4.19 and 0.4.20. The area in which the change happened seems to be relevant.

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

All looks good in VSCode/Calva.
Don't know if this issue should bother any longer ... what do you think?
Again, thanks a lot.

from datalevin.

huahaiy avatar huahaiy commented on May 19, 2024

I thought about this a little more, relying on JVM default encoding looks a little dangerous, for it means that the database files may become un-transferable from one OS/locale to another. For example, the default encoding of JVM on Mac/Linux is UTF-8, but the default on Windows is not. We would like to have more control on encoding. So I have decided to use UTF-8 everywhere in our code base, will release 0.4.22 to address this.

Please test 0.4.22 to see if your problem is addressed.

from datalevin.

KaterMikesch avatar KaterMikesch commented on May 19, 2024

That kind of rubustness sounds really good.

Just tested version 0.4.22 with Emacs/Cider and it worked flawlessly.
Thanks once again.

from datalevin.

Related Issues (20)

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.