# LegacyStrings.UTF8String

**URL:** <https://discourse.julialang.org/t/legacystrings-utf8string/75010>\
**Category:** General Usage\
**Tags:** strings\
**Created:** [January 21, 2022, 9:14pm UTC](https://discourse.julialang.org/t/legacystrings-utf8string/75010 "2022-01-21T21:14:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [January 21, 2022, 9:14pm UTC](https://discourse.julialang.org/t/legacystrings-utf8string/75010/1 "2022-01-21T21:14:57Z")

</div>

`Core.String` is a utf8 string written in C. What is the difference between it and [`LegacyStrings.UTF8String`](https://github.com/JuliaStrings/LegacyStrings.jl)?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 21, 2022, 9:53pm UTC](https://discourse.julialang.org/t/legacystrings-utf8string/75010/2 "2022-01-21T21:53:32Z")

</div>

> [@jzr](#):
>
> `Core.String` is a utf8 string written in C. What is the difference between it and [`LegacyStrings.UTF8String`](https://github.com/JuliaStrings/LegacyStrings.jl)?

(Actually, many of the `String` functions are written in Julia.)

The `LegacyStrings.UTF8String` is obsolete code and probably shouldn’t be used these days. IIRC, the biggest difference is that `LegacyStrings.UTF8String` is much less forgiving of invalid-UTF8 data, whereas `String` can contain any possible byte sequence and tries to handle as many operations as possible on the data (which required a [change to `Char`](https://discourse.julialang.org/t/changes-to-the-representation-of-char/7291/5) cleverly devised by @StefanKarpinski).

In early Julia, we had separate `UTF8String` and `ASCIIString` types, and when the strings were overhauled ([Julia#24999](https://github.com/JuliaLang/julia/pull/24999)) we shoveled all of the old code into the `LegacyStrings` package so that people could continue using code based on the old types.
