presidentbeef / ffi-gdbm Goto Github PK
View Code? Open in Web Editor NEWgdbm library using Ruby-FFI, particularly for JRuby
gdbm library using Ruby-FFI, particularly for JRuby
I'm getting this odd error now when I try to use the GDBM gem. The gem used to work. Now when I invoke the GDBM gem I get this error (I get it across many different versions of ruby):
dyld: lazy symbol binding failed: Symbol not found: __gdbm_lock_file
Referenced from: /usr/local/lib/libgdbm.dylib
Expected in: flat namespace
dyld: Symbol not found: __gdbm_lock_file
Referenced from: /usr/local/lib/libgdbm.dylib
Expected in: flat namespace
I've tried numerous ruby versions and installing/uninstalling GDBM from Brew.
The only major thing I can think has changed is that I'm now running on OSX El Capitan 10.11.6. Or that I somehow made a change to my config or PATH files that could have brought this on.
My GDBM Brew installation is at /usr/local/Cellar/gdbm/1.12
Hi there,
I was trying to follow this general guide on scraping, and had gotten everything working until I tried using this gem to dump JSON data to it.
After a lot of investigation I realized the issue is due to GDBM saving files in ASCII format, while ruby now relies primarily on UTF-8 encoding.
This code below independently replicates the problem I'm encountering:
#!/usr/bin/env ruby
# encoding: UTF-8
require 'gdbm'
require 'json'
# # Data Storage Formats
testdb = GDBM.new("test.db") # GDBM file
dump = {} # in memory
# # Test Data
str = 'โ' # #<Encoding:UTF-8>
# # stays UTF-8
puts "-------Without GDBM:"
str.encoding # => #<Encoding:UTF-8>
dump[str] = JSON.dump(str)
puts dump[str].encoding # => #<Encoding:UTF-8>
# # GDBM saves to ASCII-8BIT
puts "-------With GDBM:"
str.encoding # => #<Encoding:UTF-8>
testdb[str] = JSON.dump(str)
puts testdb[str].encoding # => #<Encoding:ASCII-8BIT>
JSON.load(testdb[str]) # `parse': 795: unexpected token at '"?' (JSON::ParserError)
At the end you can see how the incorrect encoding will trigger an error when the text being parsed has UTF-8 characters.
Is there a way to have GDBM
play nice with UTF-8
?
In other words, it is segfaulting on a 64bit system and not on a 32bit system.
No idea why, yet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.