@@ -363,12 +363,11 @@ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], - portCString, &hints, &res0)) + if (getaddrinfo([host UTF8String], portCString, &hints, &res0)) @throw [OFAddressTranslationFailedException exceptionWithHost: host socket: self]; for (res = res0; res != NULL; res = res->ai_next) { @@ -397,12 +396,12 @@ memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = OF_BSWAP16_IF_LE(port); - if ((addr.sin_addr.s_addr = inet_addr([host cStringWithEncoding: - OF_STRING_ENCODING_NATIVE])) != (in_addr_t)(-1)) { + if ((addr.sin_addr.s_addr = inet_addr([host UTF8String])) != + (in_addr_t)(-1)) { if ((_socket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { @throw [OFConnectionFailedException exceptionWithHost: host port: port @@ -429,12 +428,11 @@ # ifdef OF_HAVE_THREADS addrlist = [[OFDataArray alloc] initWithItemSize: sizeof(char**)]; [mutex lock]; # endif - if ((he = gethostbyname([host cStringWithEncoding: - OF_STRING_ENCODING_NATIVE])) == NULL) { + if ((he = gethostbyname([host UTF8String])) == NULL) { # ifdef OF_HAVE_THREADS [addrlist release]; [mutex unlock]; # endif @throw [OFAddressTranslationFailedException @@ -574,12 +572,11 @@ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], - portCString, &hints, &res)) + if (getaddrinfo([host UTF8String], portCString, &hints, &res)) @throw [OFAddressTranslationFailedException exceptionWithHost: host socket: self]; if ((_socket = socket(res->ai_family, SOCK_STREAM, @@ -605,20 +602,19 @@ #else memset(&addr, 0, sizeof(addr)); addr.in.sin_family = AF_INET; addr.in.sin_port = OF_BSWAP16_IF_LE(port); - if ((addr.in.sin_addr.s_addr = inet_addr([host cStringWithEncoding: - OF_STRING_ENCODING_NATIVE])) == (in_addr_t)(-1)) { + if ((addr.in.sin_addr.s_addr = inet_addr([host UTF8String])) == + (in_addr_t)(-1)) { # ifdef OF_HAVE_THREADS [mutex lock]; @try { # endif struct hostent *he; - if ((he = gethostbyname([host cStringWithEncoding: - OF_STRING_ENCODING_NATIVE])) == NULL) + if ((he = gethostbyname([host UTF8String])) == NULL) @throw [OFAddressTranslationFailedException exceptionWithHost: host socket: self]; if (he->h_addrtype != AF_INET || @@ -760,12 +756,11 @@ if (getnameinfo((struct sockaddr*)_sockAddr, _sockAddrLen, host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) @throw [OFAddressTranslationFailedException exceptionWithSocket: self]; - return [OFString stringWithCString: host - encoding: OF_STRING_ENCODING_NATIVE]; + return [OFString stringWithUTF8String: host]; } @finally { [self freeMemory: host]; } #else # ifdef OF_HAVE_THREADS @@ -777,12 +772,11 @@ if (host == NULL) @throw [OFAddressTranslationFailedException exceptionWithSocket: self]; - return [OFString stringWithCString: host - encoding: OF_STRING_ENCODING_NATIVE]; + return [OFString stringWithUTF8String: host]; # ifdef OF_HAVE_THREADS } @finally { [mutex unlock]; } # endif