GithubHelp home page GithubHelp logo

ffi-gdbm's People

Contributors

asppsa avatar joeyates avatar presidentbeef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

schneems asppsa

ffi-gdbm's Issues

dyld: lazy symbol binding failed: Symbol not found: __gdbm_lock_file

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

GDBM saves files in ASCII-8BIT, causes problems with UTF-8

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?

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.