BUG: Fix encoding for Stata format 118 files
State: closed

Ensure that Stata 118 files always use utf-8 encoding

- [x] closes #21244 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Unicode
description: Unicode strings
name: IO Stata
description: read_stata, to_stata

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21279?src=pr&el=h1) Report
> Merging [#21279](https://codecov.io/gh/pandas-dev/pandas/pull/21279?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b32fdc44206c38aecbbe5fdb4ed543a5d213ebb9?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21279/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/21279?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #21279   +/-   ##
=======================================
  Coverage   91.85%   91.85%           
=======================================
  Files         153      153           
  Lines       49549    49549           
=======================================
  Hits        45512    45512           
  Misses       4037     4037
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.25% <ø> (ø)` | :arrow_up: |
| #single | `41.87% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21279?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21279?src=pr&el=footer). Last update [b32fdc4...ac8c2c2](https://codecov.io/gh/pandas-dev/pandas/pull/21279?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Hello @bashtage! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on June 05, 2018 at 07:20 Hours UTC
I removed the deprecation.
@bashtage so the fix looks good. can your restore the encoding paramater then can merge into 0.23.1 (and then come back with another PR to deprecate it)? thxs
I removed the deprecation warning but encoding is now a no-op, which is the correct behavior.  

I'd rather not restore the (potentially) broken behavior where users are allowed to set an invalid encoding (e.g. latin-1 for more recent file formats), and this can wait to 24 if you think this is too much change for a bug fix release. 
> I'd rather not restore the (potentially) broken behavior where users are allowed to set an invalid encoding (e.g. latin-1 for more recent file formats), and this can wait to 24 if you think this is too much change for a bug fix release.

Yes, we should not remove the keyword for 0.23.1, even when it was a no-op, because that breaks people code who inadvertently used it. So I would add it back here, but then a next PR to deprecate it if you want.
The keyword is still available in read_Stata and Stata Reader and so code
won't break.

On Wed, Jun 6, 2018, 13:54 Joris Van den Bossche <notifications@github.com>
wrote:

> I'd rather not restore the (potentially) broken behavior where users are
> allowed to set an invalid encoding (e.g. latin-1 for more recent file
> formats), and this can wait to 24 if you think this is too much change for
> a bug fix release.
>
> Yes, we should not remove the keyword for 0.23.1, even when it was a
> no-op, because that breaks people code who inadvertently used it. So I
> would add it back here, but then a next PR to deprecate it if you want.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/21279#issuecomment-395057715>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFU5Rahuwy53qij-xodhPX9G9cdjgDq3ks5t59DugaJpZM4UV4zG>
> .
>

Ah, sorry, missed that you only removed the internal passing through of the keyword. That's fine then!
@bashtage Thanks!