<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFStringConvertWindowsCodepageToEncoding(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFStringConvertWindowsCodepageToEncoding"
  },
  "title" : "CFStringConvertWindowsCodepageToEncoding(_:)"
}
-->

# CFStringConvertWindowsCodepageToEncoding(_:)

Returns the Core Foundation encoding constant that is the closest mapping to a given Windows codepage identifier.

```
func CFStringConvertWindowsCodepageToEncoding(_ codepage: UInt32) -> CFStringEncoding
```

## Parameters

`codepage`

The Windows codepage identifier to use.

## Return Value

The Core Foundation string encoding that is closest to the Windows codepage identifier `codepage`. Returns the [`kCFStringEncodingInvalidId`](/documentation/CoreFoundation/kCFStringEncodingInvalidId) constant if the mapping is not known.

## Discussion

The [`CFStringConvertEncodingToWindowsCodepage(_:)`](/documentation/CoreFoundation/CFStringConvertEncodingToWindowsCodepage(_:)) function is complementary to this function.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)