Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-415

strod produces locale-dependent results for encoding Fleece

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.0
    • 2.7.0
    • LiteCore
    • Security Level: Public
    • None
    • CBL Sprint 4
    • 2

    Description

      https://github.com/couchbase/couchbase-lite-core/issues/849

      Not sure that couchbaselabs/fleece is monitoring for new issues,
      so reporting problem here.

      I have problem with couchbase-lite-core,
      I save document with field: 138.17 and after that I read it back from database,
      I got field: 138.0, 0.17 is missed.

      After debugging I find out out that after calling of c4db_encodeJSON .0.17 is disapear.
      This is because of JSONConverter::pop use strtod which locale depended.

      I debug this issue on machine where decimal point character from locale is ,.
      So strtod got "138.17" as input and give 138.0 as output, because of decimal point character in JSON is . by specification, while strtod expects ,.

      So it would be great if couchbase-lite-core doesn't depend on global variable (current locale) which user can change via environment variable in any moment, for example via LC_NUMERIC=XYZ on Linux.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          Build couchbase-lite-cblite-2.6.0-157 contains couchbase-lite-core commit 92c1df9 with commit message:
          CBL-415 Enhanced floating point stringification

          build-team Couchbase Build Team added a comment - Build couchbase-lite-cblite-2.6.0-157 contains couchbase-lite-core commit 92c1df9 with commit message: CBL-415 Enhanced floating point stringification

          Build couchbase-lite-ios-2.7.0-39 contains couchbase-lite-core commit 92c1df9 with commit message:
          CBL-415 Enhanced floating point stringification

          build-team Couchbase Build Team added a comment - Build couchbase-lite-ios-2.7.0-39 contains couchbase-lite-core commit 92c1df9 with commit message: CBL-415 Enhanced floating point stringification

          Build couchbase-lite-net-2.7.0-45 contains couchbase-lite-core commit 92c1df9 with commit message:
          CBL-415 Enhanced floating point stringification

          build-team Couchbase Build Team added a comment - Build couchbase-lite-net-2.7.0-45 contains couchbase-lite-core commit 92c1df9 with commit message: CBL-415 Enhanced floating point stringification

          Build couchbase-lite-log-2.7.0-79 contains couchbase-lite-core commit 92c1df9 with commit message:
          CBL-415 Enhanced floating point stringification

          build-team Couchbase Build Team added a comment - Build couchbase-lite-log-2.7.0-79 contains couchbase-lite-core commit 92c1df9 with commit message: CBL-415 Enhanced floating point stringification

          Build couchbase-lite-cblite-2.7.0-5 contains couchbase-lite-core commit 92c1df9 with commit message:
          CBL-415 Enhanced floating point stringification

          build-team Couchbase Build Team added a comment - Build couchbase-lite-cblite-2.7.0-5 contains couchbase-lite-core commit 92c1df9 with commit message: CBL-415 Enhanced floating point stringification

          People

            jimb Jim Borden
            jimb Jim Borden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty