internal/ascii: new internal package consolidating common functions #68736
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Proposal Details
The standard packages write their own ASCII helper functions many times, for examples you can find ASCII-only
isSpace
,toUpper
andequalFold
in "encoding/json", "net", "internal/filepathlite". The "net/http" also has a internal package callednet/http/internal/ascii
.Handling ASCII-encoded characters is a common requirement in the standard library, so a new package can share these logic and eliminate duplicate codes.
Based on my investigation of the standard library code, the new package should have these functions in it:
This package should minimize external dependencies, and some necessary constants can be copied from packages such as "unicode".
Normal users can continue to use "bytes", "strings" and "unicode" for most tasks, so there is little point in making this package public. However, many standard packages can't directly import packages like "unicode", "strings", etc., so I thought it would be appropriate to put this new package in "internal".
The text was updated successfully, but these errors were encountered: