ip_geo_lookup 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0601436e0e024d961710da12de5d7c10c35313d8897b7be079fc3390fa81ca6b
4
- data.tar.gz: 32c4761630525ed6680b0c07702b57ede98620c14b1b46923540bb27b1413f0e
3
+ metadata.gz: ea6488fcae67b2a8f2410b546c5b1221537fd79a479ddb171d8ab7c8c4b0ceaf
4
+ data.tar.gz: cae667b6dbefb63e664c9ba23dad5ed962f668929cf336ed1db3a1b9990e2346
5
5
  SHA512:
6
- metadata.gz: 90aba9801a0dee3934b96d87422384199c71c2789b93cb09597740c507c6495b832a7266736a019c91fa349909112a6e28bb874d0ebf6ef85bfc1ec03f794250
7
- data.tar.gz: c8019c62235992b11a030166ffec4c797e1d2f610adaf95f0fcc3d743bd1a9ee28a8a748d18eddd13dedf7b722746a8f97d89b6b81caf0f745a9e580e3c1df29
6
+ metadata.gz: 939e008059236ce7b03000d2a641b9b158bdc4f1e1f605c72d52a32e0fa59cf1aea104cc9211f52b2a542d71ced400cf463227a147a643b0b17eeb8dfb58eeff
7
+ data.tar.gz: 527c273c7349b7c2df38a283ec63b18cdff7c1197fe2f1b3d21cde0e4eb7788903bc1160ae178af2e25ea708d1ac8cfd539a00ff8d49ecfeea4c10c09f8b8e0b
data/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.2] - 2026-04-13
11
+
12
+ ### Fixed
13
+
14
+ - Normalize non-ASCII characters in geolocation string fields (`country_name`, `region`, `city`, `continent_name`) to ASCII-only Latin characters
15
+ - Accented Latin characters are transliterated via Unicode NFD decomposition (e.g., "São Paulo" → "Sao Paulo", "Zürich" → "Zurich")
16
+ - Non-Latin scripts (Arabic, Chinese, Devanagari, Armenian, Georgian, Hebrew) are stripped to guarantee consistent ASCII output
17
+
10
18
  ## [0.1.1] - 2026-03-30
11
19
 
12
20
  ### Fixed
@@ -33,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33
41
  - CI via GitHub Actions: test matrix (Ruby 2.6, 3.0, 4.0), StandardRB linting, automated gem publishing
34
42
  - Dependabot for actions and bundler dependency updates
35
43
 
36
- [Unreleased]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.1...HEAD
44
+ [Unreleased]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.2...HEAD
45
+ [0.1.2]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.1...v0.1.2
37
46
  [0.1.1]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.0...v0.1.1
38
47
  [0.1.0]: https://github.com/msuliq/ip_geo_lookup/releases/tag/v0.1.0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IpGeoLookup
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/ip_geo_lookup.rb CHANGED
@@ -70,11 +70,11 @@ module IpGeoLookup
70
70
  def build_result(record)
71
71
  Result.new(
72
72
  country_code: deep_fetch(record, "country", "iso_code"),
73
- country_name: deep_fetch(record, "country", "names", "en"),
74
- region: deep_fetch(record, "subdivisions", 0, "names", "en"),
75
- city: deep_fetch(record, "city", "names", "en"),
73
+ country_name: normalize_str(deep_fetch(record, "country", "names", "en")),
74
+ region: normalize_str(deep_fetch(record, "subdivisions", 0, "names", "en")),
75
+ city: normalize_str(deep_fetch(record, "city", "names", "en")),
76
76
  continent_code: deep_fetch(record, "continent", "code"),
77
- continent_name: deep_fetch(record, "continent", "names", "en"),
77
+ continent_name: normalize_str(deep_fetch(record, "continent", "names", "en")),
78
78
  latitude: deep_fetch(record, "location", "latitude"),
79
79
  longitude: deep_fetch(record, "location", "longitude"),
80
80
  time_zone: deep_fetch(record, "location", "time_zone"),
@@ -83,6 +83,16 @@ module IpGeoLookup
83
83
  )
84
84
  end
85
85
 
86
+ def normalize_str(str)
87
+ return nil if str.nil?
88
+
89
+ str = str.encode("UTF-8") unless str.encoding == Encoding::UTF_8
90
+ str.unicode_normalize(:nfd)
91
+ .gsub(/[^\p{ASCII}]/, "")
92
+ .gsub(/\s+/, " ")
93
+ .strip
94
+ end
95
+
86
96
  def deep_fetch(obj, *keys)
87
97
  keys.each do |key|
88
98
  case obj
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip_geo_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suleyman Musayev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-30 00:00:00.000000000 Z
11
+ date: 2026-04-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A lightweight, zero-dependency Ruby gem for resolving IPv4 and IPv6 addresses
14
14
  to country, region, city, coordinates, and more. Ships with an embedded MaxMind