Commit Graph

436 Commits

Author SHA1 Message Date
gingerBill
2f3aefbb3d Change strings.Builder to be distinct [dynamic]byte from a struct wrapper 2026-06-09 13:56:10 +01:00
Yawning Angel
e7698e4adf core/encoding/pem: Initial import 2026-06-02 17:48:46 +09:00
Yawning Angel
82a18797b4 core/encoding/base64: Misc fixes and improvements
- Add error checking to `decode`
- Add `encode_into_buf`/`decode_into_buf`
2026-05-26 00:38:50 +09:00
A1029384756
45a79f96f0 [encoding/json] add support for unmarshalling fixed capacity dynamic arrays 2026-05-21 11:48:25 -04:00
Brad Lewis
87d58b9fb7 Handle invalid utf8 when parsing json 2026-05-10 16:23:26 +10:00
Laytan
d90cc4e3b6 json: fix user unmarshaller example (#6468)
* json: fix user unmarshaller example

- Returning `.None` in the custom unmarshaler is wrong, should be `nil`
- `advance_token` has to be called

Besides the fixes I made it an actual example that will show up on the package docs
2026-03-23 21:28:47 +01:00
Laytan
99dffb344a Merge pull request #6424 from andzdroid/patch-4
encoding/cbor: fix order-dependent partial unmarshals
2026-03-16 15:17:57 +01:00
andzdroid
f123fb1e91 encoding/cbor: fix order-dependent partial unmarshals 2026-03-15 13:20:57 +00:00
gingerBill
7b0121756c Update core/encoding/cbor/marshal.odin
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2026-03-14 16:22:01 +00:00
gingerBill
e485d82c9d cbor support for fixed capacity dynamic arrays 2026-03-12 13:01:29 +00:00
gingerBill
4df2de057b Add Type_Info_Fixed_Capacity_Dynamic_Array to json 2026-03-11 18:43:01 +00:00
Jeroen van Rijn
82b3917300 Update unicode.xml to 17 2026-02-21 14:02:41 +01:00
Jeroen van Rijn
ac11491979 Update generated table 2026-02-21 01:55:07 +01:00
Krzesimir Nowak
a90f2ad3a0 Print errors in tools and examples to stderr 2026-02-17 23:08:32 +01:00
Krzesimir Nowak
47775214d6 Fix some tools and examples after core:os update and using-stmt feature 2026-02-17 21:58:08 +01:00
Jeroen van Rijn
2622c1ab99 Fix #6229
Fixes #6229 by adding `encode_upper` and `encode_upper_into_writer`.

Also updated the documentation to be more like the rest of `core`.
2026-02-14 13:57:02 +01:00
Jeroen van Rijn
c0300a3303 Remove core:mem imports from core:encoding. 2026-02-12 18:19:24 +01:00
Jeroen van Rijn
e7dbabf668 core:os -> core:os/old && core:os/os2 -> core:os 2026-02-09 15:50:21 +01:00
Jeroen van Rijn
8ed264680b Remove all core:os imports from JS targets
Fix `local_tz_name` on FreeBSD.
2026-02-09 15:07:27 +01:00
Jeroen van Rijn
02477b2526 eprintf 2026-02-08 12:44:06 +01:00
Jeroen van Rijn
e094de5874 Add loc := #caller_location to read_entire_file 2026-02-08 12:44:05 +01:00
Jeroen van Rijn
f63c209478 Convert core:encoding/hxa 2026-02-08 12:42:26 +01:00
Jeroen van Rijn
304f22c8af core:os -> core:os/os for CSV, INI, and XML
Also had to vendor `core:encoding/ini` into `core:os/os2` for the user directories on *nix,
as it used that package to read `~/.config/user-dirs.dirs`, causing an import cycle.
2026-02-08 12:42:24 +01:00
Isabella Basso
56445dff97 encoding/xml: pass allocator on destroy 2026-01-25 21:33:23 -03:00
Jeroen van Rijn
3f8a32aeb9 Merge branch 'master' into xmlcomment 2026-01-22 11:47:23 +01:00
gingerBill
0de3d872d1 Keep -vet happy 2026-01-19 19:32:41 +00:00
gingerBill
85b3251105 Remove the nbsp change, as it is not necessary 2026-01-19 19:30:37 +00:00
gingerBill
fddc732869 Escape non-breaking space (0xa0) to &nbsp; 2026-01-19 18:17:13 +00:00
Jeroen van Rijn
27ac0ebc37 Merge pull request #6145 from odin-lang/bill/html-escape
Update `core:encoding/entity`
2026-01-18 13:37:45 +01:00
gingerBill
ba20bfa5f4 Update generated.odin 2026-01-18 12:17:28 +00:00
gingerBill
871cedc701 Keep -vet happy 2026-01-18 11:47:51 +00:00
gingerBill
23198f7917 Move html escaping calls and fix existing generator 2026-01-18 11:45:40 +00:00
rykad
454f75cb22 core:encoding/base64: add support for url variant 2026-01-17 22:26:25 +00:00
StudebakerGuy
14d6371058 Comment includiing -- at end
Comments are incorrectly including -- a the end. This was due
to the comment slice being returned 2 charachters too long.
2026-01-07 19:28:44 -05:00
StudebakerGuy
dc37ff5036 Comments before first emlement not being captured
The xml library was not correctly detect that a comment occured
before the first element. This addresses the issue, but the comment
incorrectly includes --.
2026-01-07 19:28:44 -05:00
Jeroen van Rijn
b6ea6f7a12 Merge pull request #5882 from IllusionMan1212/custom-json-marshalling
encoding/json: custom json (un)marshalling
2026-01-01 16:07:01 +00:00
dozn
8fea2b783c [encoding/json] Allow Unmarshalling to rune
Fixes https://github.com/odin-lang/Odin/issues/6061
2025-12-30 18:10:07 -08:00
dozn
589dbbddd2 [encoding/json] Fix Escapes When Marshalling
Fixes https://github.com/odin-lang/Odin/issues/6060 and https://github.com/odin-lang/Odin/issues/6075
The boolean "true" was setting `html_safe` instead of `for_json`.
Chalk one up for the "use enums instead of booleans" crowd.
2025-12-30 17:02:06 -08:00
dozn
affaefc13a Moved first_iteration up a couple lines so it makes sense readability-wise. 2025-12-30 04:42:06 -08:00
dozn
ba68d75c6f Add JSON5/SJSON Comments When Marshalling
Allows user-facing JSON5/SJSON to have comments explaining field usage.
`json.Marshal_Options.pretty` must be enabled since we only use single-line comments (not to mention it wouldn't be terribly useful without `pretty` set anyways).
We don't escape anything, so `\n` will display as "\n", but you're still able to enter in a proper newline character and it'll be displayed on multiple lines.
2025-12-29 12:23:54 -08:00
Laytan
852ea91cdb Merge pull request #6078 from BigBoyBarney/json-arrays
Fix standard json parsing / unmarshalling issue for pure arrays
2025-12-29 15:53:51 +01:00
Sylphrena
6441fc09e0 Fix standard json parsing / unmarshalling issue for pure arrays 2025-12-29 15:35:34 +01:00
Zoltán Kéri
d802a4e9fa encoding/base32: Fix padding validation for malformed input
Fix a bug where padding characters in the middle of input were
not detected when there was no trailing padding.

The "verify no padding in middle" check was inside `if
padding_count > 0`, so inputs like "MZ===YTBMZXW6YTB" would
incorrectly pass validation.

Test case added for this edge case.
2025-12-27 04:30:37 +01:00
StudebakerGuy
ab74b8283d Address issue identifying of CDATA
The XML library wasn't identifying CDATA and skipping over it.
This was found when CDATA contained a <. This patch addresses
that issue.
2025-12-23 09:35:09 -05:00
Jeroen van Rijn
83fb7ba952 Make custom JSON (un)marshalers more like core:fmt's 2025-12-10 17:54:12 +01:00
Hisham Aburaqibah
72d65603eb encoding/json: error handling for custom (un)marshallers 2025-12-02 22:46:35 +02:00
IllusionMan1212
4b9e15786d encoding/json: custom json (un)marshalling 2025-12-02 22:46:31 +02:00
Franz Hoeltermann
cd4bec0007 Increase base64 decoding table size to 256, preventing out of bounds reads 2025-11-22 12:54:36 +01:00
Neirokan
8cdf7ade48 encoding/json: clone unquoted strings 2025-11-06 19:24:58 +03:00
gingerBill
e5153a937b Merge pull request #5859 from odin-lang/bill/change-license
Change Odin's LICENSE to zlib from BSD 3-clause
2025-11-04 13:53:13 +00:00